summaryrefslogtreecommitdiff
path: root/django/core
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2016-10-12 21:19:56 -0400
committerTim Graham <timograham@gmail.com>2016-10-13 11:42:56 -0400
commit91cc5fd4cce58361aab9554a6bb695c854df641a (patch)
treefc2f07a87a3b3ad8c3802fa26708a36e111f2791 /django/core
parente781197d1cc2dcef850104acd0baac1c748d40d7 (diff)
[1.10.x] Fixed #27200 -- Provided makemigration's allow_migrate() with model_name.
Backport of cd09524f27b83c0ca9dabafa81265e8d8abd252a from master
Diffstat (limited to 'django/core')
-rw-r--r--django/core/management/commands/makemigrations.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/django/core/management/commands/makemigrations.py b/django/core/management/commands/makemigrations.py
index 2fb2d713ca..2bb1ca9a41 100644
--- a/django/core/management/commands/makemigrations.py
+++ b/django/core/management/commands/makemigrations.py
@@ -100,9 +100,12 @@ class Command(BaseCommand):
aliases_to_check = connections if settings.DATABASE_ROUTERS else [DEFAULT_DB_ALIAS]
for alias in sorted(aliases_to_check):
connection = connections[alias]
- if (connection.settings_dict['ENGINE'] != 'django.db.backends.dummy' and
- # At least one app must be migrated to the database.
- any(router.allow_migrate(connection.alias, label) for label in consistency_check_labels)):
+ if (connection.settings_dict['ENGINE'] != 'django.db.backends.dummy' and any(
+ # At least one model must be migrated to the database.
+ router.allow_migrate(connection.alias, app_label, model_name=model._meta.object_name)
+ for app_label in consistency_check_labels
+ for model in apps.get_models(app_label)
+ )):
loader.check_consistent_history(connection)
# Before anything else, see if there's conflicting apps and drop out