From 6873eeeefbc3a081c98351ff25b4cdc42dbf3d7d Mon Sep 17 00:00:00 2001 From: Baptiste Mispelon Date: Thu, 13 Feb 2014 12:23:12 +0100 Subject: Fixed #22030 -- Don't assume that all fields have a swappable_setting attribute. --- django/db/migrations/autodetector.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'django') diff --git a/django/db/migrations/autodetector.py b/django/db/migrations/autodetector.py index 2b8759b29a..868d2bdc0f 100644 --- a/django/db/migrations/autodetector.py +++ b/django/db/migrations/autodetector.py @@ -233,7 +233,8 @@ 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 + new_field = new_apps.get_model(app_label, model_name)._meta.get_field_by_name(field_name)[0] + swappable_setting = getattr(new_field, 'swappable_setting', None) if swappable_setting is not None: self.add_swappable_dependency(app_label, swappable_setting) # Old fields -- cgit v1.3