Ticket #20252: 20252.diff

File 20252.diff, 1.1 KB (added by Claude Paroz, 12 years ago)
  • django/contrib/gis/db/backends/spatialite/operations.py

    diff --git a/django/contrib/gis/db/backends/spatialite/operations.py b/django/contrib/gis/db/backends/spatialite/operations.py
    index 5eaa778..151ecfe 100644
    a b from django.core.exceptions import ImproperlyConfigured  
    1010from django.db.backends.sqlite3.base import DatabaseOperations
    1111from django.db.utils import DatabaseError
    1212from django.utils import six
     13from django.utils.functional import cached_property
     14
    1315
    1416class SpatiaLiteOperator(SpatialOperation):
    1517    "For SpatiaLite operators (e.g. `&&`, `~`)."
    class SpatiaLiteOperations(DatabaseOperations, BaseSpatialOperations):  
    146148            except DatabaseError:
    147149                # we are using < 2.4.0-RC4
    148150                pass
    149         if version >= (3, 0, 0):
    150             self.geojson = 'AsGeoJSON'
     151
     152    @cached_property
     153    def geojson(self):
     154        return 'AsGeoJSON' if self.spatialite_version_tuple()[1:] >= (3, 0, 0) else None
    151155
    152156    def check_aggregate_support(self, aggregate):
    153157        """
Back to Top