diff options
| author | Claude Paroz <claude@2xlibre.net> | 2014-01-30 09:49:02 +0100 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2014-01-30 09:49:02 +0100 |
| commit | 9c8d62a06fc83efa019f23b6b87b39a82c95ab97 (patch) | |
| tree | d8a55d0286b70d10f65114ac871c994792d4cf0d | |
| parent | fabc678f930431fd6e502fe7930ee772eff96898 (diff) | |
Fixed #21907 -- Fixed add_srs_entry for Spatialite >= 4
Thanks dfunckt for the report.
| -rw-r--r-- | django/contrib/gis/utils/srs.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/django/contrib/gis/utils/srs.py b/django/contrib/gis/utils/srs.py index 6c8a03d333..8e72466de4 100644 --- a/django/contrib/gis/utils/srs.py +++ b/django/contrib/gis/utils/srs.py @@ -64,9 +64,11 @@ def add_srs_entry(srs, auth_name='EPSG', auth_srid=None, ref_sys_name=None, } # Backend-specific fields for the SpatialRefSys model. - if connection.ops.postgis: + srs_field_names = SpatialRefSys._meta.get_all_field_names() + if 'srtext' in srs_field_names: kwargs['srtext'] = srs.wkt - if connection.ops.spatialite: + if 'ref_sys_name' in srs_field_names: + # Spatialite specific kwargs['ref_sys_name'] = ref_sys_name or srs.name # Creating the spatial_ref_sys model. |
