diff --git a/django/contrib/gis/db/backends/base.py b/django/contrib/gis/db/backends/base.py index 570d0a5bae..a132e80661 100644 --- a/django/contrib/gis/db/backends/base.py +++ b/django/contrib/gis/db/backends/base.py @@ -18,6 +18,8 @@ class BaseSpatialFeatures(object): # Does the backend support the django.contrib.gis.utils.add_srs_entry() utility? supports_add_srs_entry = True + # Does the backend introspect GeometryField to its subtypes? + supports_geometry_field_introspection = True # Reference implementation of 3D functions is: # http://postgis.net/docs/PostGIS_Special_Functions_Index.html#PostGIS_3D_Functions diff --git a/django/contrib/gis/db/backends/oracle/base.py b/django/contrib/gis/db/backends/oracle/base.py index eaa1ebebe7..c1b48bccfa 100644 --- a/django/contrib/gis/db/backends/oracle/base.py +++ b/django/contrib/gis/db/backends/oracle/base.py @@ -10,6 +10,7 @@ from django.contrib.gis.db.backends.oracle.operations import OracleOperations class DatabaseFeatures(BaseSpatialFeatures, OracleDatabaseFeatures): supports_add_srs_entry = False + supports_geometry_field_introspection = False class DatabaseWrapper(OracleDatabaseWrapper): diff --git a/django/contrib/gis/tests/inspectapp/tests.py b/django/contrib/gis/tests/inspectapp/tests.py index 04da3c4de8..cf64cee071 100644 --- a/django/contrib/gis/tests/inspectapp/tests.py +++ b/django/contrib/gis/tests/inspectapp/tests.py @@ -5,7 +5,7 @@ import re from unittest import skipUnless from django.core.management import call_command -from django.db import connections +from django.db import connection, connections from django.test import TestCase, skipUnlessDBFeature from django.contrib.gis.gdal import HAS_GDAL from django.contrib.gis.geometry.test_data import TEST_DATA @@ -30,8 +30,12 @@ class InspectDbTests(TestCase): table_name_filter=lambda tn: tn.startswith('inspectapp_'), stdout=out) output = out.getvalue() - self.assertIn('geom = models.PolygonField()', output) - self.assertIn('point = models.PointField()', output) + if connection.features.supports_geometry_field_introspection: + self.assertIn('geom = models.PolygonField()', output) + self.assertIn('point = models.PointField()', output) + else: + self.assertIn('geom = models.GeometryField(', output) + self.assertIn('point = models.GeometryField(', output) self.assertIn('objects = models.GeoManager()', output)