Added feature flag for geometry_field_introspection; refs #22632 and #23504.

This commit is contained in:
Tim Graham 2014-09-17 17:58:20 -04:00
parent 6c1a0581ab
commit 33e817a6d8
3 changed files with 10 additions and 3 deletions

View File

@ -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

View File

@ -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):

View File

@ -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)