[1.7.x] Ignore through being None on some special cases of fields.
This commit is contained in:
parent
6e248d8f8c
commit
71f573330b
|
@ -156,7 +156,7 @@ class MigrationAutodetector(object):
|
||||||
old_model_state = self.from_state.models[app_label, old_model_name]
|
old_model_state = self.from_state.models[app_label, old_model_name]
|
||||||
for field_name, field in old_model_state.fields:
|
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]
|
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 = (
|
through_key = (
|
||||||
old_field.rel.through._meta.app_label,
|
old_field.rel.through._meta.app_label,
|
||||||
old_field.rel.through._meta.object_name.lower(),
|
old_field.rel.through._meta.object_name.lower(),
|
||||||
|
|
Loading…
Reference in New Issue