Made the migration detector use meta.local_fields instead of meta.fields.

Refs #21010.

Thanks to Loïc for the patch.
This commit is contained in:
Baptiste Mispelon 2013-12-06 15:20:16 +01:00
parent 19e4374971
commit 72479a2957
1 changed files with 1 additions and 1 deletions

View File

@ -67,7 +67,7 @@ class MigrationAutodetector(object):
model_state = self.to_state.models[app_label, model_name] 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. # Are there any relationships out from this model? if so, punt it to the next phase.
related_fields = [] 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:
if field.rel.to: if field.rel.to:
related_fields.append((field.name, field.rel.to._meta.app_label.lower(), field.rel.to._meta.object_name.lower())) related_fields.append((field.name, field.rel.to._meta.app_label.lower(), field.rel.to._meta.object_name.lower()))