Fixed #23161: Drop PostGIS geography fields correctly

This commit is contained in:
Andrew Godwin 2014-08-04 14:06:33 +10:00
parent 059f5d17c5
commit d4f62a7ae7
1 changed files with 3 additions and 1 deletions

View File

@ -99,7 +99,9 @@ class PostGISSchemaEditor(DatabaseSchemaEditor):
def remove_field(self, model, field):
from django.contrib.gis.db.models.fields import GeometryField
if not isinstance(field, GeometryField) or self.connection.ops.spatial_version > (2, 0):
if not isinstance(field, GeometryField) or \
self.connection.ops.spatial_version > (2, 0) or \
field.geography:
super(PostGISSchemaEditor, self).remove_field(model, field)
else:
self.execute(