mirror of
https://github.com/django/django.git
synced 2025-10-24 22:26:08 +00:00
Fixed #24725 -- Allowed renaming of target models in ManyToMany relations
This is a regression caused by introducing rendered migration states in1aa3e09c20and the _meta refactoring infb48eb0581. Thanks to Danilo Bargen for reporting the issue and Marten Kenbeek and Tim Graham for triaging the bug and providing the initial test case.
This commit is contained in:
@@ -161,7 +161,7 @@ class RenameModel(Operation):
|
||||
# Get all of the related objects we need to repoint
|
||||
all_related_objects = (
|
||||
f for f in model._meta.get_fields(include_hidden=True)
|
||||
if f.auto_created and not f.concrete and not (f.hidden or f.many_to_many)
|
||||
if f.auto_created and not f.concrete and (not f.hidden or f.many_to_many)
|
||||
)
|
||||
# Rename the model
|
||||
state.models[app_label, self.new_name_lower] = state.models[app_label, self.old_name_lower]
|
||||
|
||||
Reference in New Issue
Block a user