Jun-21-2018, 11:30 AM
(Jun-21-2018, 10:04 AM)gontajones Wrote: I'll install this Django app to see how it works.
What is the content of location field when you try to add a new Place from the admin/ site?
I am able to make it works. There was some db data issue. My update code is as below-
models.py:
class Store(models.Model): postal_code = models.CharField(max_length=6) address = models.TextField() location = PlainLocationField(based_fields=['address'], zoom=7, null=True) phone = models.CharField(max_length=60, blank=True, null=True) latitude = models.FloatField() longitude = models.FloatField() class Meta: managed = False db_table = 'store'admin.py:
class StoreAdmin(admin.ModelAdmin):
list_display = ('postal_code', 'address','phone', 'latitude', 'longitude')
So once user entered the address, location is auto filled with the values of latitude,longitude.
Since I have separate fields for storing latitude/longitude; I want to fetch their values from the location field and put them in respective fields.
How can I do that with some Python function?