Python Forum
How to auto fill latitude and longitude fields in Django2.0.6?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to auto fill latitude and longitude fields in Django2.0.6?
#9
(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?
Reply


Messages In This Thread
RE: How to auto fill latitude and longitude fields in Django2.0.6? - by PrateekG - Jun-21-2018, 11:30 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Selenium fields containing a word graham23s 3 2,927 Aug-22-2023, 12:35 PM
Last Post: Gaurav_Kumar
  Registration Form Fields rwahdan 2 1,953 Aug-09-2022, 10:35 AM
Last Post: Addweb
  How to fill text fields web forms Martinelli 1 2,086 Sep-25-2019, 11:14 PM
Last Post: Martinelli
  How to fetch latitude,longitude from location and save them separately in db(Django2) PrateekG 0 2,689 Jun-21-2018, 04:40 AM
Last Post: PrateekG

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020