From 013c2d8d02e679c969255d9b11214d020dd34418 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Wed, 31 Dec 2014 13:21:32 +0800 Subject: [PATCH] Renamed variables to avoid name collision with import of django.db.models. --- django/db/migrations/autodetector.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/django/db/migrations/autodetector.py b/django/db/migrations/autodetector.py index 16e7a7d40c..440b83880c 100644 --- a/django/db/migrations/autodetector.py +++ b/django/db/migrations/autodetector.py @@ -450,11 +450,11 @@ class MigrationAutodetector(object): old_keys = set(self.old_model_keys).union(self.old_unmanaged_keys) added_models = set(self.new_model_keys) - old_keys added_unmanaged_models = set(self.new_unmanaged_keys) - old_keys - models = chain( + all_added_models = chain( sorted(added_models, key=self.swappable_first_key, reverse=True), sorted(added_unmanaged_models, key=self.swappable_first_key, reverse=True) ) - for app_label, model_name in models: + for app_label, model_name in all_added_models: model_state = self.to_state.models[app_label, model_name] model_opts = self.new_apps.get_model(app_label, model_name)._meta # Gather related fields @@ -629,8 +629,8 @@ class MigrationAutodetector(object): new_keys = set(self.new_model_keys).union(self.new_unmanaged_keys) deleted_models = set(self.old_model_keys) - new_keys deleted_unmanaged_models = set(self.old_unmanaged_keys) - new_keys - models = chain(sorted(deleted_models), sorted(deleted_unmanaged_models)) - for app_label, model_name in models: + all_deleted_models = chain(sorted(deleted_models), sorted(deleted_unmanaged_models)) + for app_label, model_name in all_deleted_models: model_state = self.from_state.models[app_label, model_name] model = self.old_apps.get_model(app_label, model_name) if not model._meta.managed: