Ticket #17278: 17278-spatialite-settings.diff

File 17278-spatialite-settings.diff, 2.1 KB (added by julien, 3 years ago)
  • django/contrib/gis/db/backends/spatialite/creation.py

    diff --git a/django/contrib/gis/db/backends/spatialite/creation.py b/django/contrib/gis/db/backends/spatialite/creation.py
    index d0a5f82..27332b9 100644
    a b class SpatiaLiteCreation(DatabaseCreation): 
    3030
    3131        self.connection.close()
    3232        self.connection.settings_dict["NAME"] = test_database_name
     33        self.connection.ops.confirm_spatial_components_versions()
    3334
    3435        # Need to load the SpatiaLite initialization SQL before running `syncdb`.
    3536        self.load_spatialite_sql()
  • 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 60fe0a8..80f05ef 100644
    a b class SpatiaLiteOperations(DatabaseOperations, BaseSpatialOperations): 
    113113    def __init__(self, connection):
    114114        super(DatabaseOperations, self).__init__(connection)
    115115
     116        # Creating the GIS terms dictionary.
     117        gis_terms = ['isnull']
     118        gis_terms += self.geometry_functions.keys()
     119        self.gis_terms = dict([(term, None) for term in gis_terms])
     120
     121    def confirm_spatial_components_versions(self):
    116122        # Determine the version of the SpatiaLite library.
    117123        try:
    118124            vtup = self.spatialite_version_tuple()
    class SpatiaLiteOperations(DatabaseOperations, BaseSpatialOperations): 
    129135                                       'SQL loaded on this database?' %
    130136                                       (self.connection.settings_dict['NAME'], msg))
    131137
    132         # Creating the GIS terms dictionary.
    133         gis_terms = ['isnull']
    134         gis_terms += list(self.geometry_functions)
    135         self.gis_terms = dict([(term, None) for term in gis_terms])
    136 
    137138        if version >= (2, 4, 0):
    138139            # Spatialite 2.4.0-RC4 added AsGML and AsKML, however both
    139140            # RC2 (shipped in popular Debian/Ubuntu packages) and RC4
Back to Top