Re: [Django] #33638: Saving unique geography fields crashes in the admin on PostGIS. (was: Model Admin for GIS models cannot save model with point field when (geography=True, unique=True) with postgis backend)

6 views
Skip to first unread message

Django

unread,
Apr 13, 2022, 4:04:00 AM4/13/22
to django-...@googlegroups.com
#33638: Saving unique geography fields crashes in the admin on PostGIS.
----------------------------------+------------------------------------
Reporter: Sebastian Clarke | Owner: nobody
Type: Bug | Status: new
Component: GIS | Version: 3.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+------------------------------------
Changes (by Mariusz Felisiak):

* cc: Claude Paroz (added)
* stage: Unreviewed => Accepted


Comment:

I was able to reproduce this issue, however using geography type is really
limited on PostGIS (see
[https://docs.djangoproject.com/en/stable/ref/contrib/gis/model-api
/#geography-type-1 docs]) and `__bboverlaps` is not an option in the
general case. I wonder how we could improve this, I can imagine two
options:
- raise a system warning when `unique` is used with `geography` and skip
these fields in unique checks,
- cast `geography` fields to a `geometry` type in the query.

What do you think?

--
Ticket URL: <https://code.djangoproject.com/ticket/33638#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Reply all
Reply to author
Forward
0 new messages