Fixed #21958: Handle dependencies for swappable models in AddField

This commit is contained in:
Andrew Godwin 2014-02-09 12:46:38 +00:00
parent 42607a9e33
commit 11c021336c
1 changed files with 3 additions and 0 deletions

View File

@ -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]