From 362dd68fb20be195462af22448416c9895ce7df7 Mon Sep 17 00:00:00 2001 From: Ramiro Morales Date: Fri, 6 Dec 2013 08:48:05 -0300 Subject: [PATCH] Added new 'srtext' spatialite 4.x SpatialRefSys column to its model. This is for general consistency in the GeoDjango DB backends. Thanks Claude for the fix. Refs #19678. --- django/contrib/gis/db/backends/spatialite/models.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/django/contrib/gis/db/backends/spatialite/models.py b/django/contrib/gis/db/backends/spatialite/models.py index 9860779647..551bc70ccd 100644 --- a/django/contrib/gis/db/backends/spatialite/models.py +++ b/django/contrib/gis/db/backends/spatialite/models.py @@ -1,7 +1,7 @@ """ The GeometryColumns and SpatialRefSys models for the SpatiaLite backend. """ -from django.db import models +from django.db import connection, models from django.contrib.gis.db.backends.base import SpatialRefSysMixin from django.utils.encoding import python_2_unicode_compatible @@ -53,9 +53,13 @@ class SpatialRefSys(models.Model, SpatialRefSysMixin): auth_srid = models.IntegerField() ref_sys_name = models.CharField(max_length=256) proj4text = models.CharField(max_length=2048) + if connection.ops.spatial_version[0] >= 4: + srtext = models.CharField(max_length=2048) @property def wkt(self): + if hasattr(self, 'srtext'): + return self.srtext from django.contrib.gis.gdal import SpatialReference return SpatialReference(self.proj4text).wkt