File tree Expand file tree Collapse file tree 1 file changed +2
-4
lines changed
django_mongodb_backend_gis Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change 1
- from django .contrib .gis .db .models import GeometryField
2
1
from pymongo import GEOSPHERE
3
2
from pymongo .operations import IndexModel
4
3
@@ -38,9 +37,8 @@ def _alter_field(
38
37
new_db_params ,
39
38
strict = strict ,
40
39
)
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 )
44
42
if not old_field_spatial_index and new_field_spatial_index :
45
43
self ._add_spatial_index (model , new_field )
46
44
elif old_field_spatial_index and not new_field_spatial_index :
You can’t perform that action at this time.
0 commit comments