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.
This commit is contained in:
Ramiro Morales 2013-12-06 08:48:05 -03:00
parent 621c25c419
commit 362dd68fb2
1 changed files with 5 additions and 1 deletions

View File

@ -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