summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorAndrew Godwin <andrew@aeracode.org>2014-07-25 09:35:25 -0700
committerAndrew Godwin <andrew@aeracode.org>2014-07-25 09:35:38 -0700
commita64bc3df77e074ddb7aa5c42eb2a84c26917a3b7 (patch)
tree30e9b5a37e18efa8b23829344e10721c56fcc38b /django
parentf44dbf74a4abf9c45d49568c7ca46363ff6e5112 (diff)
Fixed #23093: soft application detection for swapped models
Diffstat (limited to 'django')
-rw-r--r--django/db/migrations/executor.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/django/db/migrations/executor.py b/django/db/migrations/executor.py
index ecd9d0fdf2..10cbfc80f0 100644
--- a/django/db/migrations/executor.py
+++ b/django/db/migrations/executor.py
@@ -1,6 +1,7 @@
from __future__ import unicode_literals
from django.db import migrations
+from django.apps.registry import apps as global_apps
from .loader import MigrationLoader
from .recorder import MigrationRecorder
@@ -136,6 +137,10 @@ class MigrationExecutor(object):
for operation in migration.operations:
if isinstance(operation, migrations.CreateModel):
model = apps.get_model(migration.app_label, operation.name)
+ if model._meta.swapped:
+ # We have to fetch the model to test with from the
+ # main app cache, as it's not a direct dependency.
+ model = global_apps.get_model(model._meta.swapped)
if model._meta.db_table not in self.connection.introspection.get_table_list(self.connection.cursor()):
return False
found_create_migration = True