erdem / django-map-widgets

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

Invalid JSON error reported whenever a `PointField` is saved with the `GooglePointFieldWidget` in the Django admin #138

Closed tvanesse closed 1 year ago

tvanesse commented 1 year ago

I am using Django 4.1 and GooglePointFieldWidget on PointFields.

The widget gets displayed as it should and I'm able to change the coordinates, set a marker on the map or even type in an address. All good.

The problem is that I'm getting a validation error upon saving the object because GooglePointFieldWidget fills in the hidden textarea of the field with invalid JSON, something like

POINT (26.2616671966018 65.06716787213769)

when Django expects something like

{'type': 'Point', 'coordinates': [26.2616671966018, 65.06716787213769]}

image

How can I solve this validation error?