Opened 13 years ago
Last modified 13 years ago
#16556 closed Bug
django.contrib.gis.utils.srs fails to preserve database when creating SpatialRefSys querysets — at Version 2
Reported by: | anonymous | Owned by: | jbronn |
---|---|---|---|
Component: | GIS | Version: | 1.3 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
django.contrib.gis.utils.srs
fails to preserve database when creating SpatialRefSys
querysets
Currently, the code (line ~70 or so) reads like this:
# Creating the spatial_ref_sys model. try: # Try getting via SRID only, because using all kwargs may # differ from exact wkt/proj in database. sr = SpatialRefSys.objects.get(srid=srs.srid) except SpatialRefSys.DoesNotExist: sr = SpatialRefSys.objects.create(**kwargs)
It should read like this:
# Creating the spatial_ref_sys model. try: # Try getting via SRID only, because using all kwargs may # differ from exact wkt/proj in database. sr = SpatialRefSys.objects.using(database).get(srid=srs.srid) except SpatialRefSys.DoesNotExist: sr = SpatialRefSys.objects.using(database).create(**kwargs)
Otherwise support for multiple backends is sort of broken.
Change History (3)
comment:1 by , 13 years ago
comment:2 by , 13 years ago
Description: | modified (diff) |
---|---|
milestone: | → 1.4 |
Owner: | changed from | to
Status: | new → assigned |
Triage Stage: | Unreviewed → Accepted |
Note:
See TracTickets
for help on using tickets.
Ugh. Basically, the '.using()' method needs to be used when creating the SpatialRefSys query set. sorry for the poor formatting.