From 1667e736a7da634bbda0df171bb60a980cbab7a3 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Mon, 21 Apr 2014 22:42:11 +0200 Subject: [PATCH] Fixed PostGIS remove_field implementation Fixed bad code introduced in 2f9d1576e8. --- django/contrib/gis/db/backends/postgis/schema.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/django/contrib/gis/db/backends/postgis/schema.py b/django/contrib/gis/db/backends/postgis/schema.py index 9f2029728c..9c2fc70841 100644 --- a/django/contrib/gis/db/backends/postgis/schema.py +++ b/django/contrib/gis/db/backends/postgis/schema.py @@ -92,12 +92,12 @@ 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): super(PostGISSchemaEditor, self).remove_field(model, field) - - self.execute( - self.sql_drop_geometry_column % { - "table": self.geo_quote_name(model._meta.db_table), - "column": self.geo_quote_name(field.column), - } - ) + else: + self.execute( + self.sql_drop_geometry_column % { + "table": self.geo_quote_name(model._meta.db_table), + "column": self.geo_quote_name(field.column), + } + )