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?
#3
(Jun-19-2018, 11:14 PM)gontajones Wrote: You have to check what is the content of the location field (variable).
The split() method is just returning 1 item but your code expects 2.
latitiude, _ = self.location.split(',')
And I just saw that your wrote latitude wrong.

Thanks, it was a silly mistake, I corrected the spelling of latitude.
Currently I am giving a default value to the address field as below-
class Store(OwnedModel):
    building = models.ForeignKey(Building, related_name='building', on_delete=models.SET_NULL, blank=True, null=True)
    postal_code = models.CharField(max_length=6)
    address = models.TextField(default='Singapore')
    location = PlainLocationField(based_fields=['address'], zoom=7, null=True)
But the error is same. Should I need to store a default value of location in db also?

For testing I added location value for a store in DB and restarted the server but the error is same again.

I added a print statement after location variable in models.py and restarted the server; in server log I got:
location:: <location_field.models.plain.PlainLocationField>
location:: <location_field.models.plain.PlainLocationField>
Reply


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

Possibly Related Threads…
Thread Author Replies Views Last Post
  Selenium fields containing a word graham23s 3 2,928 Aug-22-2023, 12:35 PM
Last Post: Gaurav_Kumar
  Registration Form Fields rwahdan 2 1,957 Aug-09-2022, 10:35 AM
Last Post: Addweb
  How to fill text fields web forms Martinelli 1 2,089 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,692 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