Loading django/contrib/gis/db/backends/base.py +3 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ class BaseSpatialFeatures(object): # Does the database contain a SpatialRefSys model to store SRID information? has_spatialrefsys_table = True # Does the backend support the django.contrib.gis.utils.add_srs_entry() utility? supports_add_srs_entry = True # Reference implementation of 3D functions is: # http://postgis.net/docs/PostGIS_Special_Functions_Index.html#PostGIS_3D_Functions supports_3d_functions = False Loading django/contrib/gis/db/backends/mysql/base.py +1 −0 Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ from django.contrib.gis.db.backends.mysql.operations import MySQLOperations class DatabaseFeatures(BaseSpatialFeatures, MySQLDatabaseFeatures): has_spatialrefsys_table = False supports_add_srs_entry = False supports_distances_lookups = False supports_transform = False supports_real_shape_operations = False Loading django/contrib/gis/db/backends/oracle/base.py +1 −1 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ from django.contrib.gis.db.backends.oracle.operations import OracleOperations class DatabaseFeatures(BaseSpatialFeatures, OracleDatabaseFeatures): pass supports_add_srs_entry = False class DatabaseWrapper(OracleDatabaseWrapper): Loading django/contrib/gis/tests/test_spatialrefsys.py +1 −0 Original line number Diff line number Diff line Loading @@ -105,6 +105,7 @@ class SpatialRefSysTest(unittest.TestCase): for i in range(3): self.assertAlmostEqual(ellps1[i], ellps2[i], prec[i]) @skipUnlessDBFeature('supports_add_srs_entry') def test_add_entry(self): """ Test adding a new entry in the SpatialRefSys model using the Loading django/contrib/gis/utils/srs.py +2 −3 Original line number Diff line number Diff line Loading @@ -39,9 +39,8 @@ def add_srs_entry(srs, auth_name='EPSG', auth_srid=None, ref_sys_name=None, if not hasattr(connection.ops, 'spatial_version'): raise Exception('The `add_srs_entry` utility only works ' 'with spatial backends.') if connection.ops.oracle or connection.ops.mysql: raise Exception('This utility does not support the ' 'Oracle or MySQL spatial backends.') if not connection.features.supports_add_srs_entry: raise Exception('This utility does not support your database backend.') SpatialRefSys = connection.ops.spatial_ref_sys() # If argument is not a `SpatialReference` instance, use it as parameter Loading Loading
django/contrib/gis/db/backends/base.py +3 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ class BaseSpatialFeatures(object): # Does the database contain a SpatialRefSys model to store SRID information? has_spatialrefsys_table = True # Does the backend support the django.contrib.gis.utils.add_srs_entry() utility? supports_add_srs_entry = True # Reference implementation of 3D functions is: # http://postgis.net/docs/PostGIS_Special_Functions_Index.html#PostGIS_3D_Functions supports_3d_functions = False Loading
django/contrib/gis/db/backends/mysql/base.py +1 −0 Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ from django.contrib.gis.db.backends.mysql.operations import MySQLOperations class DatabaseFeatures(BaseSpatialFeatures, MySQLDatabaseFeatures): has_spatialrefsys_table = False supports_add_srs_entry = False supports_distances_lookups = False supports_transform = False supports_real_shape_operations = False Loading
django/contrib/gis/db/backends/oracle/base.py +1 −1 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ from django.contrib.gis.db.backends.oracle.operations import OracleOperations class DatabaseFeatures(BaseSpatialFeatures, OracleDatabaseFeatures): pass supports_add_srs_entry = False class DatabaseWrapper(OracleDatabaseWrapper): Loading
django/contrib/gis/tests/test_spatialrefsys.py +1 −0 Original line number Diff line number Diff line Loading @@ -105,6 +105,7 @@ class SpatialRefSysTest(unittest.TestCase): for i in range(3): self.assertAlmostEqual(ellps1[i], ellps2[i], prec[i]) @skipUnlessDBFeature('supports_add_srs_entry') def test_add_entry(self): """ Test adding a new entry in the SpatialRefSys model using the Loading
django/contrib/gis/utils/srs.py +2 −3 Original line number Diff line number Diff line Loading @@ -39,9 +39,8 @@ def add_srs_entry(srs, auth_name='EPSG', auth_srid=None, ref_sys_name=None, if not hasattr(connection.ops, 'spatial_version'): raise Exception('The `add_srs_entry` utility only works ' 'with spatial backends.') if connection.ops.oracle or connection.ops.mysql: raise Exception('This utility does not support the ' 'Oracle or MySQL spatial backends.') if not connection.features.supports_add_srs_entry: raise Exception('This utility does not support your database backend.') SpatialRefSys = connection.ops.spatial_ref_sys() # If argument is not a `SpatialReference` instance, use it as parameter Loading