summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Godwin <andrew@aeracode.org>2014-06-16 14:58:35 -0700
committerAndrew Godwin <andrew@aeracode.org>2014-06-16 14:58:35 -0700
commitfa9a26745f3aac5c9d2402069d4c99ac328d2fdf (patch)
tree39591ea07b832fee5c7a97563499c37f5733fc9d
parent4529af9ecf7debc9281021462531ec4d9697013b (diff)
Ignore through being None on some special cases of fields.
-rw-r--r--django/db/migrations/autodetector.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/django/db/migrations/autodetector.py b/django/db/migrations/autodetector.py
index 1ef4becaae..8638faaf68 100644
--- a/django/db/migrations/autodetector.py
+++ b/django/db/migrations/autodetector.py
@@ -156,7 +156,7 @@ class MigrationAutodetector(object):
old_model_state = self.from_state.models[app_label, old_model_name]
for field_name, field in old_model_state.fields:
old_field = self.old_apps.get_model(app_label, old_model_name)._meta.get_field_by_name(field_name)[0]
- if hasattr(old_field, "rel") and hasattr(old_field.rel, "through") and not old_field.rel.through._meta.auto_created:
+ if hasattr(old_field, "rel") and getattr(old_field.rel, "through", None) and not old_field.rel.through._meta.auto_created:
through_key = (
old_field.rel.through._meta.app_label,
old_field.rel.through._meta.object_name.lower(),