coderholic / django-cities

Countries and cities of the world for Django projects
MIT License
930 stars 374 forks source link

Autocomplete widget with map #174

Open vladimirmyshkovski opened 7 years ago

vladimirmyshkovski commented 7 years ago

Checklist

Steps to reproduce

Expected behavior

Hey.

I want to provide an opportunity for users to have a widget like this so that they can enter the address and see their point on the map.

One option is to parse the answer from Google or another provider, and search for objects in the database.

Another option is to get the longitude and latitude from the widget, and for longitude and latitude, look for the nearest country / city / district.

In any case, I want to use your application, and in addition I need a custom widget.

How can i do this ?

If you direct me to the right idea, I'm ready to push, or I'll make a small extension that will stacked with yours.

Actual behavior

blag commented 7 years ago

Check out another project I maintain, django-osm-field. It should do what you want.

When you submit the form you should be able to access json.loads(form.cleaned_data['location_data']) and setup the Country/Region/Subregion/City accordingly.

But I would definitely appreciate a PR implementing a custom form field/widget that does that.

vladimirmyshkovski commented 7 years ago

@blag , I can not get the region and subregion from the data received from the providers.

If it were not for these two components, it would be more or less simple.

blag commented 6 years ago

@narnikgamarnikus You'll have to add some details to your last comment. Are you having an issue importing the region and subregion data? If so, please open a separate issue for those. If it's something else, please explain.