Skip to content

Commit 6eab1a3

Browse files
committed
remove GeometryField in _alter_field()
1 parent e523bff commit 6eab1a3

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

django_mongodb_backend_gis/schema.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from django.contrib.gis.db.models import GeometryField
21
from pymongo import GEOSPHERE
32
from pymongo.operations import IndexModel
43

@@ -38,9 +37,8 @@ def _alter_field(
3837
new_db_params,
3938
strict=strict,
4039
)
41-
42-
old_field_spatial_index = isinstance(old_field, GeometryField) and old_field.spatial_index
43-
new_field_spatial_index = isinstance(new_field, GeometryField) and new_field.spatial_index
40+
old_field_spatial_index = getattr(old_field, "spatial_index", False)
41+
new_field_spatial_index = getattr(new_field, "spatial_index", False)
4442
if not old_field_spatial_index and new_field_spatial_index:
4543
self._add_spatial_index(model, new_field)
4644
elif old_field_spatial_index and not new_field_spatial_index:

0 commit comments

Comments
 (0)