Skip to content

Instantly share code, notes, and snippets.

@loic
Created December 6, 2013 12:20
Show Gist options
  • Save loic/7822873 to your computer and use it in GitHub Desktop.
Save loic/7822873 to your computer and use it in GitHub Desktop.
diff --git a/django/db/migrations/autodetector.py b/django/db/migrations/autodetector.py
index 86ddd3c..78c9770 100644
--- a/django/db/migrations/autodetector.py
+++ b/django/db/migrations/autodetector.py
@@ -67,7 +67,7 @@ class MigrationAutodetector(object):
model_state = self.to_state.models[app_label, model_name]
# Are there any relationships out from this model? if so, punt it to the next phase.
related_fields = []
- for field in new_app_cache.get_model(app_label, model_name)._meta.fields:
+ for field in new_app_cache.get_model(app_label, model_name)._meta.local_fields:
if field.rel:
if field.rel.to:
related_fields.append((field.name, field.rel.to._meta.app_label.lower(), field.rel.to._meta.object_name.lower()))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment