summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2015-08-10 08:03:08 -0400
committerTim Graham <timograham@gmail.com>2015-08-10 10:29:36 -0400
commitb27547f9d1c3d3e0e0bd466cc841f966a42e67cd (patch)
treec176c11b34866388f6884a4679b6ff1ef8b3972d
parentf2e4c7aca48374cd18f7e3bea333bbb5d73154cf (diff)
Removed deprecated GeoManager from inspectdb/ogrinspect output.
refs ea27e26b0907e74ab8d6c46a9694775a310fdc67
-rw-r--r--django/contrib/gis/management/commands/inspectdb.py15
-rw-r--r--django/contrib/gis/utils/ogrinspect.py1
-rw-r--r--tests/gis_tests/inspectapp/tests.py9
3 files changed, 2 insertions, 23 deletions
diff --git a/django/contrib/gis/management/commands/inspectdb.py b/django/contrib/gis/management/commands/inspectdb.py
index 229be74276..27345c59d4 100644
--- a/django/contrib/gis/management/commands/inspectdb.py
+++ b/django/contrib/gis/management/commands/inspectdb.py
@@ -4,7 +4,6 @@ from django.core.management.commands.inspectdb import \
class Command(InspectDBCommand):
db_module = 'django.contrib.gis.db'
- gis_tables = {}
def get_field_type(self, connection, table_name, row):
field_type, field_params, field_notes = super(Command, self).get_field_type(connection, table_name, row)
@@ -14,18 +13,4 @@ class Command(InspectDBCommand):
# from the `get_geometry_type` routine for the spatial backend.
field_type, geo_params = connection.introspection.get_geometry_type(table_name, geo_col)
field_params.update(geo_params)
- # Adding the table name and column to the `gis_tables` dictionary, this
- # allows us to track which tables need a GeoManager.
- if table_name in self.gis_tables:
- self.gis_tables[table_name].append(geo_col)
- else:
- self.gis_tables[table_name] = [geo_col]
return field_type, field_params, field_notes
-
- def get_meta(self, table_name, constraints):
- meta_lines = super(Command, self).get_meta(table_name, constraints)
- if table_name in self.gis_tables:
- # If the table is a geographic one, then we need make
- # GeoManager the default manager for the model.
- meta_lines.insert(0, ' objects = models.GeoManager()')
- return meta_lines
diff --git a/django/contrib/gis/utils/ogrinspect.py b/django/contrib/gis/utils/ogrinspect.py
index dcc464e11f..3cf9b10fd5 100644
--- a/django/contrib/gis/utils/ogrinspect.py
+++ b/django/contrib/gis/utils/ogrinspect.py
@@ -232,7 +232,6 @@ def _ogrinspect(data_source, model_name, geom_name='geom', layer_key=0, srid=Non
srid_str = 'srid=%s' % srid
yield ' %s = models.%s(%s)' % (geom_name, geom_field, srid_str)
- yield ' objects = models.GeoManager()'
if name_field:
yield ''
diff --git a/tests/gis_tests/inspectapp/tests.py b/tests/gis_tests/inspectapp/tests.py
index 6525e995ca..c272b65aa8 100644
--- a/tests/gis_tests/inspectapp/tests.py
+++ b/tests/gis_tests/inspectapp/tests.py
@@ -40,7 +40,6 @@ class InspectDbTests(TestCase):
else:
self.assertIn('geom = models.GeometryField(', output)
self.assertIn('point = models.GeometryField(', output)
- self.assertIn('objects = models.GeoManager()', output)
@skipUnlessDBFeature("supports_3d_storage")
def test_3d_columns(self):
@@ -59,7 +58,6 @@ class InspectDbTests(TestCase):
self.assertIn('point = models.GeometryField(', output)
self.assertIn('line = models.GeometryField(', output)
self.assertIn('poly = models.GeometryField(', output)
- self.assertIn('objects = models.GeoManager()', output)
@skipUnless(HAS_GDAL, "OGRInspectTest needs GDAL support")
@@ -82,7 +80,6 @@ class OGRInspectTest(TestCase):
' int = models.{}()'.format('BigIntegerField' if GDAL_VERSION >= (2, 0) else 'FloatField'),
' str = models.CharField(max_length=80)',
' geom = models.PolygonField(srid=-1)',
- ' objects = models.GeoManager()',
]
self.assertEqual(model_def, '\n'.join(expected))
@@ -110,7 +107,6 @@ class OGRInspectTest(TestCase):
' density = models.FloatField()',
' created = models.DateField()',
' geom = models.PointField(srid=-1)',
- ' objects = models.GeoManager()',
]
self.assertEqual(model_def, '\n'.join(expected))
@@ -147,9 +143,8 @@ class OGRInspectTest(TestCase):
self.assertIn(' f_char = models.CharField(max_length=10)', model_def)
self.assertIn(' f_date = models.DateField()', model_def)
- self.assertIsNotNone(re.search(
- r' geom = models.PolygonField\(([^\)])*\)\n' # Some backends may have srid=-1
- r' objects = models.GeoManager\(\)', model_def))
+ # Some backends may have srid=-1
+ self.assertIsNotNone(re.search(r' geom = models.PolygonField\(([^\)])*\)', model_def))
def test_management_command(self):
shp_file = os.path.join(TEST_DATA, 'cities', 'cities.shp')