erdem / django-map-widgets

Highly customizable, intuitive, and user-friendly map widgets for GeoDjango applications.
MIT License
450 stars 119 forks source link

autocomplete not working #51

Closed dadokkio closed 6 years ago

dadokkio commented 6 years ago

Hi, I'm using this widget on a django 2.0 website. The map is working with geolocation and when I click or move a marker the input field is updated with correct address. But if I try to use the autocomplete field it raises some errors: On focus change: Uncaught TypeError: b.get is not a function On click: Uncaught TypeError: Cannot read property 'location' of undefined

image

Any thoughts?

erdem commented 6 years ago

This issue can be relevant with Django 2.0 compatible problems.

https://github.com/erdem/django-map-widgets/issues/44

Also, it can be a credential problem. Did you check your Google API key and settings?

http://django-map-widgets.readthedocs.io/en/latest/widgets/point_field_map_widgets.html#usage

dadokkio commented 6 years ago

I don't think is the same problem. I had an issue similar to #44 when I forgot to include {{ form.media }} in the header.

The API should be ok, I can see the query when I move the marker. image

dadokkio commented 6 years ago

Ok, I've just updated the package installed from pip cause I need the latest commit and now it seems to work properly. Thanks

felocru commented 6 years ago

Hi, I have had exactly the same problem. After debugging for several minutes I realized that if you enter it from the settings: componentRestrictions': {'country': 'london'} Returns the error Commenting on this line, the problem is gone. I detected the problem. Must be: Countries must be passed as as a two-character, ISO 3166-1 Alpha-2 compatible country code. London has more than 2 characters.