From d77f92fa1ee473160f50ab8482876e4bab33f8cf Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Mon, 4 Aug 2014 14:06:33 +1000 Subject: [PATCH] [1.7.x] Fixed #23161: Drop PostGIS geography fields correctly --- django/contrib/gis/db/backends/postgis/schema.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/django/contrib/gis/db/backends/postgis/schema.py b/django/contrib/gis/db/backends/postgis/schema.py index db59d34492..2a9f4c01b0 100644 --- a/django/contrib/gis/db/backends/postgis/schema.py +++ b/django/contrib/gis/db/backends/postgis/schema.py @@ -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(