Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #21958: Handle dependencies for swappable models in AddField

  • Loading branch information...
commit 11c021336c8cb1c92be998f1a44c89a746275107 1 parent 42607a9
@andrewgodwin andrewgodwin authored
Showing with 3 additions and 0 deletions.
  1. +3 −0  django/db/migrations/autodetector.py
View
3  django/db/migrations/autodetector.py
@@ -233,6 +233,9 @@ def _detect_changes(self):
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]
Please sign in to comment.
Something went wrong with that request. Please try again.