mirror of
https://github.com/django/django.git
synced 2025-06-14 16:09:12 +00:00
Fixed #25308 -- Made MigrationQuestioner respect MIGRATION_MODULES setting.
This commit is contained in:
parent
91ec1841f5
commit
1175027641
@ -9,7 +9,7 @@ from django.db.models.fields import NOT_PROVIDED
|
|||||||
from django.utils import datetime_safe, six, timezone
|
from django.utils import datetime_safe, six, timezone
|
||||||
from django.utils.six.moves import input
|
from django.utils.six.moves import input
|
||||||
|
|
||||||
from .loader import MIGRATIONS_MODULE_NAME
|
from .loader import MigrationLoader
|
||||||
|
|
||||||
|
|
||||||
class MigrationQuestioner(object):
|
class MigrationQuestioner(object):
|
||||||
@ -37,7 +37,7 @@ class MigrationQuestioner(object):
|
|||||||
app_config = apps.get_app_config(app_label)
|
app_config = apps.get_app_config(app_label)
|
||||||
except LookupError: # It's a fake app.
|
except LookupError: # It's a fake app.
|
||||||
return self.defaults.get("ask_initial", False)
|
return self.defaults.get("ask_initial", False)
|
||||||
migrations_import_path = "%s.%s" % (app_config.name, MIGRATIONS_MODULE_NAME)
|
migrations_import_path = MigrationLoader.migrations_module(app_config.label)
|
||||||
try:
|
try:
|
||||||
migrations_module = importlib.import_module(migrations_import_path)
|
migrations_module = importlib.import_module(migrations_import_path)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
@ -610,6 +610,16 @@ class MakeMigrationsTests(MigrationTestBase):
|
|||||||
call_command("makemigrations", "migrations", stdout=out)
|
call_command("makemigrations", "migrations", stdout=out)
|
||||||
self.assertIn("No changes detected in app 'migrations'", out.getvalue())
|
self.assertIn("No changes detected in app 'migrations'", out.getvalue())
|
||||||
|
|
||||||
|
def test_makemigrations_no_apps_initial(self):
|
||||||
|
"""
|
||||||
|
makemigrations should detect initial is needed on empty migration
|
||||||
|
modules if no app provided.
|
||||||
|
"""
|
||||||
|
out = six.StringIO()
|
||||||
|
with self.temporary_migration_module(module="migrations.test_migrations_empty"):
|
||||||
|
call_command("makemigrations", stdout=out)
|
||||||
|
self.assertIn("0001_initial.py", out.getvalue())
|
||||||
|
|
||||||
def test_makemigrations_migrations_announce(self):
|
def test_makemigrations_migrations_announce(self):
|
||||||
"""
|
"""
|
||||||
Makes sure that makemigrations announces the migration at the default verbosity level.
|
Makes sure that makemigrations announces the migration at the default verbosity level.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user