noors312 / django_2gis_maps

2gis maps for django admin
MIT License
10 stars 3 forks source link
css3 django django-2gis-maps geolocation-field html5 javascript python3

Django 2GIS maps

django_2gis_maps is a simple application that provides the basic hooks into django_2gis_maps V2 api for use in Django models from Django version 1.11+.

Starting with django_2gis_maps version (0.7.0), Django 1.11+ is required because Django changed their widget template rendering system.

I'm using this to allow someone from the admin panels to type a freeform address, have the address geocoded on change and plotted on the map. If the location is not 100% correct, the user can drag the marker to the correct spot and the geo coordinates will update.


alt tag

INSTALLATION

I also like to make the geolocation field readonly in the admin so a user (myself) doesn't accidentally change it to a nonsensical value. There is validation on the field so you can't enter an incorrect value, but you could enter something that is not even close to the address you intended.

When you're displaying the address back to the user, just request the map using the geocoordinates that were saved in your model. Maybe sometime when I get around to it I'll see if I can create a method that will build that into the model.