Commit 362dd68f authored by Ramiro Morales's avatar Ramiro Morales
Browse files

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.
parent 621c25c4
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
"""
 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