@@ -291,15 +291,15 @@ def alter_unique_together(self, model, old_unique_together, new_unique_together)
291
291
def _model_indexes_sql (self , model ):
292
292
"""
293
293
Return a list of all index SQL statements (field indexes,
294
- Meta.indexes) for the specified model.
294
+ index_together, Meta.indexes) for the specified model.
295
295
"""
296
296
if not model ._meta .managed or model ._meta .proxy or model ._meta .swapped :
297
297
return []
298
298
output = []
299
299
for field in model ._meta .local_fields :
300
300
output .extend (self ._field_indexes_sql (model , field ))
301
301
302
- for field_names in model ._meta .indexes :
302
+ for field_names in model ._meta .index_together :
303
303
fields = [model ._meta .get_field (field ) for field in field_names ]
304
304
output .append (self ._create_index_sql (model , fields , suffix = "_idx" ))
305
305
@@ -792,7 +792,7 @@ def _alter_field(self, model, old_field, new_field, old_type, new_type,
792
792
if old_field .db_index and new_field .db_index :
793
793
index_columns .append ([old_field ])
794
794
else :
795
- for fields in model ._meta .indexes :
795
+ for fields in model ._meta .index_together :
796
796
columns = [model ._meta .get_field (field ) for field in fields ]
797
797
if old_field .column in [c .column for c in columns ]:
798
798
index_columns .append (columns )
@@ -917,7 +917,7 @@ def _delete_indexes(self, model, old_field, new_field):
917
917
index_columns .append ([old_field .column ])
918
918
elif old_field .null != new_field .null :
919
919
index_columns .append ([old_field .column ])
920
- for fields in model ._meta .indexes :
920
+ for fields in model ._meta .index_together :
921
921
columns = [model ._meta .get_field (field ).column for field in fields ]
922
922
if old_field .column in columns :
923
923
index_columns .append (columns )
@@ -1322,7 +1322,7 @@ def create_model(self, model):
1322
1322
model , field , field_type , field .db_comment
1323
1323
)
1324
1324
)
1325
- # Add any field index and indexes 's (deferred as SQLite3 _remake_table needs it)
1325
+ # Add any field index and index_together 's (deferred as SQLite3 _remake_table needs it)
1326
1326
self .deferred_sql .extend (self ._model_indexes_sql (model ))
1327
1327
self .deferred_sql = list (set (self .deferred_sql ))
1328
1328
0 commit comments