Jun-21-2018, 06:27 AM
Hi All,
I am doing one mistake in my code but unable to solve this.
So I am unable to return latitude,longitude from location.
Can anyone please help me to solve this?
I am doing one mistake in my code but unable to solve this.
from location_field.models.plain import PlainLocationField
class Store(OwnedModel):
address = models.TextField(default='Mumbai')
location = PlainLocationField(based_fields=['address'], zoom=7, null=True)
@property
def latitude(location):
if not location:
return
latitude = location[1]
return latitude
@property
def longitude(location):
if not location:
return
longitude = location[0]
return longitudeIssue in above code is PlainLocationField object does not support indexing.So I am unable to return latitude,longitude from location.
Can anyone please help me to solve this?
