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
21from pymongo import GEOSPHERE
32from 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 :
You can’t perform that action at this time.
0 commit comments