[1.7.x] Fix test failure caused by 3149cdce32e7261b2d44128ab712c4d4f1a5d429

This commit is contained in:
Andrew Godwin 2014-05-29 15:34:35 -07:00
parent b6a960cd1d
commit 4956e182ac

View File

@ -9,11 +9,12 @@ from django.apps import apps
from django.conf import settings from django.conf import settings
from django.core.management.base import CommandError from django.core.management.base import CommandError
from django.db import models, router from django.db import models, router
from django.db.migrations.loader import MigrationLoader
from django.utils.deprecation import RemovedInDjango19Warning from django.utils.deprecation import RemovedInDjango19Warning
def check_for_migrations(app_config, connection): def check_for_migrations(app_config, connection):
# Inner import to stop tests failing
from django.db.migrations.loader import MigrationLoader
loader = MigrationLoader(connection) loader = MigrationLoader(connection)
if app_config.label in loader.migrated_apps: if app_config.label in loader.migrated_apps:
raise CommandError("App '%s' has migrations. Only the sqlmigrate and sqlflush commands can be used when an app has migrations." % app_config.label) raise CommandError("App '%s' has migrations. Only the sqlmigrate and sqlflush commands can be used when an app has migrations." % app_config.label)