Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error creating geometry from value 'null' (String input unrecognized as WKT EWKT, and HEXEWKB.) #115

Open
Vayel opened this issue Oct 27, 2021 · 2 comments

Comments

@Vayel
Copy link
Contributor

Vayel commented Oct 27, 2021

Hi!

Thanks for this package! When used with https://github.com/makinacorpus/django-leaflet and no initial value, GeoJSONFormField raises the follow error:

Error creating geometry from value 'null' (String input unrecognized as WKT EWKT, and HEXEWKB.)

Indeed, the value is None and is dumped by JSONField into "null". The initial value should be jsonfield.forms.InvalidJSONInput(""). It can be set here if undefined: https://github.com/makinacorpus/django-geojson/blob/master/djgeojson/fields.py#L51

@Vayel
Copy link
Contributor Author

Vayel commented Jan 19, 2022

Can be set for model fields as well.

@Vayel
Copy link
Contributor Author

Vayel commented Mar 28, 2022

Actually, it should be set for model fields as well because a field with blank=True will raise the error above.

Can be done with https://docs.djangoproject.com/en/4.0/howto/custom-model-fields/#converting-values-to-python-objects

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant