1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Fixed #28051 -- Made migrations respect Index's name argument.

Thanks Marc Tamlyn for the report and Tim Graham for the review.
This commit is contained in:
Markus Holtermann
2017-04-07 17:47:53 +02:00
committed by Tim Graham
parent 5d3b322dce
commit d3cf75ec6f
3 changed files with 18 additions and 2 deletions

View File

@@ -446,7 +446,8 @@ class ModelState:
elif name == "indexes":
indexes = [idx.clone() for idx in model._meta.indexes]
for index in indexes:
index.set_name_with_model(model)
if not index.name:
index.set_name_with_model(model)
options['indexes'] = indexes
else:
options[name] = model._meta.original_attrs[name]