From 1b8d7eff3bb1de1f0b51137d720d6fcf7622bced Mon Sep 17 00:00:00 2001 From: Jani Tiainen Date: Wed, 19 Aug 2015 21:37:31 +0300 Subject: [PATCH] Refs #12400 -- Added supports_geometry_field_unique_index GIS db feature. --- django/contrib/gis/db/backends/base/features.py | 3 +++ django/contrib/gis/db/backends/oracle/features.py | 1 + tests/gis_tests/geoapp/models.py | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/django/contrib/gis/db/backends/base/features.py b/django/contrib/gis/db/backends/base/features.py index 4fd4fd18a7..779ff23689 100644 --- a/django/contrib/gis/db/backends/base/features.py +++ b/django/contrib/gis/db/backends/base/features.py @@ -40,6 +40,9 @@ class BaseSpatialFeatures(object): # Does the database have raster support? supports_raster = False + # Does the database support a unique index on geometry fields? + supports_geometry_field_unique_index = True + @property def supports_bbcontains_lookup(self): return 'bbcontains' in self.connection.ops.gis_operators diff --git a/django/contrib/gis/db/backends/oracle/features.py b/django/contrib/gis/db/backends/oracle/features.py index df0aedcf32..b0b7e27df8 100644 --- a/django/contrib/gis/db/backends/oracle/features.py +++ b/django/contrib/gis/db/backends/oracle/features.py @@ -6,3 +6,4 @@ from django.db.backends.oracle.features import \ class DatabaseFeatures(BaseSpatialFeatures, OracleDatabaseFeatures): supports_add_srs_entry = False supports_geometry_field_introspection = False + supports_geometry_field_unique_index = False diff --git a/tests/gis_tests/geoapp/models.py b/tests/gis_tests/geoapp/models.py index 664aac9d7b..a819c17ada 100644 --- a/tests/gis_tests/geoapp/models.py +++ b/tests/gis_tests/geoapp/models.py @@ -63,7 +63,7 @@ class MultiFields(NamedModel): class Meta: unique_together = ('city', 'point') - required_db_features = ['gis_enabled'] + required_db_features = ['gis_enabled', 'supports_geometry_field_unique_index'] class Truth(models.Model):