django-cities icon indicating copy to clipboard operation
django-cities copied to clipboard

Autocomplete widget with map

Open vladimirmyshkovski opened this issue 7 years ago • 3 comments

Checklist

  • [x] I have verified that I am using a GIS-enabled database, such as PostGIS or Spatialite.
  • [x] I have verified that that issue exists against the master branch of django-cities.
  • [x] I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
  • [x] I have reduced the issue to the simplest possible case.
  • [ ] I have included a failing test as a pull request. (If you are unable to do so we can still accept the issue.)

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

vladimirmyshkovski avatar Jul 19 '17 18:07 vladimirmyshkovski

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.

blag avatar Jul 20 '17 04:07 blag

@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.

vladimirmyshkovski avatar Jul 20 '17 10:07 vladimirmyshkovski

@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.

blag avatar Dec 03 '17 22:12 blag