Fixed #21958: Handle dependencies for swappable models in AddField
This commit is contained in:
parent
42607a9e33
commit
11c021336c
|
@ -233,6 +233,9 @@ class MigrationAutodetector(object):
|
|||
field=field,
|
||||
)
|
||||
)
|
||||
swappable_setting = new_apps.get_model(app_label, model_name)._meta.get_field_by_name(field_name)[0].swappable_setting
|
||||
if swappable_setting is not None:
|
||||
self.add_swappable_dependency(app_label, swappable_setting)
|
||||
# Old fields
|
||||
for app_label, model_name, field_name in old_fields - new_fields:
|
||||
old_model_state = self.from_state.models[app_label, model_name]
|
||||
|
|
Loading…
Reference in New Issue