Hi All,


I have created a store address form using Django2.0.6+Mysql+Python3.6.

Currently user has to manually fill latitude and longitude for the store 
address.

I want to auto-fill both fields once user entered the address.

Below is my current code-

models.py-

class Store(models.Model):
    building = models.ForeignKey(Building, related_name='building', 
    on_delete=models.SET_NULL, blank=True, null=True)
    name = models.CharField(max_length=100)
    postal_code = models.CharField(max_length=6)
    address = models.TextField()
    latitude = models.FloatField(validators=[MinValueValidator(-90.0), 
    MaxValueValidator(90.0)])
    longitude = models.FloatField(validators=[MinValueValidator(-180.0), 
    MaxValueValidator(180.0)])
class Meta:
    managed = False
    db_table = 'store'


admin.py-

class StoreAdmin(admin.ModelAdmin):
    list_display = ('id', 'name', 'postal_code', 'address', 'latitude', 
 'longitude')


Can anyone please help me how to achieve this requirement?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/56497a07-9c46-4413-9fab-db3f17298146%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to