From b84ecaa736fd5e33bd5d95ac70e288db976a53ff Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Tue, 12 Jul 2016 18:45:17 -0700 Subject: Fixed #26088 -- Made autodector detect changing proxy model to MTI. --- django/db/migrations/autodetector.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'django') diff --git a/django/db/migrations/autodetector.py b/django/db/migrations/autodetector.py index ae88a90465..c863dcaead 100644 --- a/django/db/migrations/autodetector.py +++ b/django/db/migrations/autodetector.py @@ -612,6 +612,20 @@ class MigrationAutodetector(object): ] ) + # Fix relationships if the model changed from a proxy model to a + # concrete model. + if (app_label, model_name) in self.old_proxy_keys: + for related_object in model_opts.related_objects: + self.add_operation( + related_object.related_model._meta.app_label, + operations.AlterField( + model_name=related_object.related_model._meta.object_name, + name=related_object.field.name, + field=related_object.field, + ), + dependencies=[(app_label, model_name, None, True)], + ) + def generate_created_proxies(self): """ Makes CreateModel statements for proxy models. -- cgit v1.3