Permalink
Browse files

Fixed #21958: Handle dependencies for swappable models in AddField

  • Loading branch information...
1 parent 42607a9 commit 11c021336c8cb1c92be998f1a44c89a746275107 @andrewgodwin andrewgodwin committed Feb 9, 2014
Showing with 3 additions and 0 deletions.
  1. +3 −0 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]

0 comments on commit 11c0213

Please sign in to comment.