Skip to content

Commit 85c3550

Browse files
charettessarahboyce
authored andcommitted
[5.1.x] Refs #27236 -- Removed references to index_together from ModelState.from_model.
It's not possible for ModelMeta.index_together to exist anymore. Backport of 44281bc from main.
1 parent 6f42b67 commit 85c3550

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

django/db/migrations/state.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -811,9 +811,6 @@ def from_model(cls, model, exclude_rels=False):
811811
if name == "unique_together":
812812
ut = model._meta.original_attrs["unique_together"]
813813
options[name] = set(normalize_together(ut))
814-
elif name == "index_together":
815-
it = model._meta.original_attrs["index_together"]
816-
options[name] = set(normalize_together(it))
817814
elif name == "indexes":
818815
indexes = [idx.clone() for idx in model._meta.indexes]
819816
for index in indexes:
@@ -829,7 +826,7 @@ def from_model(cls, model, exclude_rels=False):
829826
# If we're ignoring relationships, remove all field-listing model
830827
# options (that option basically just means "make a stub model")
831828
if exclude_rels:
832-
for key in ["unique_together", "index_together", "order_with_respect_to"]:
829+
for key in ["unique_together", "order_with_respect_to"]:
833830
if key in options:
834831
del options[key]
835832
# Private fields are ignored, so remove options that refer to them.

0 commit comments

Comments
 (0)