mirror of
https://github.com/django/django.git
synced 2025-03-27 01:30:46 +00:00
[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 44281bc2123dac1b127000c84c759f9678021826 from main.
This commit is contained in:
parent
6f42b675c7
commit
85c3550106
@ -811,9 +811,6 @@ class ModelState:
|
|||||||
if name == "unique_together":
|
if name == "unique_together":
|
||||||
ut = model._meta.original_attrs["unique_together"]
|
ut = model._meta.original_attrs["unique_together"]
|
||||||
options[name] = set(normalize_together(ut))
|
options[name] = set(normalize_together(ut))
|
||||||
elif name == "index_together":
|
|
||||||
it = model._meta.original_attrs["index_together"]
|
|
||||||
options[name] = set(normalize_together(it))
|
|
||||||
elif name == "indexes":
|
elif name == "indexes":
|
||||||
indexes = [idx.clone() for idx in model._meta.indexes]
|
indexes = [idx.clone() for idx in model._meta.indexes]
|
||||||
for index in indexes:
|
for index in indexes:
|
||||||
@ -829,7 +826,7 @@ class ModelState:
|
|||||||
# If we're ignoring relationships, remove all field-listing model
|
# If we're ignoring relationships, remove all field-listing model
|
||||||
# options (that option basically just means "make a stub model")
|
# options (that option basically just means "make a stub model")
|
||||||
if exclude_rels:
|
if exclude_rels:
|
||||||
for key in ["unique_together", "index_together", "order_with_respect_to"]:
|
for key in ["unique_together", "order_with_respect_to"]:
|
||||||
if key in options:
|
if key in options:
|
||||||
del options[key]
|
del options[key]
|
||||||
# Private fields are ignored, so remove options that refer to them.
|
# Private fields are ignored, so remove options that refer to them.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user