diff options
| author | Emre Yilmaz <mail@emreyilmaz.me> | 2015-12-03 18:51:39 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-12-21 12:54:29 -0500 |
| commit | 63a6a653d4282f74e35582d41ca507139c9cfbe1 (patch) | |
| tree | 51488cfd102ba5ea4858415aa60ecb6bee5eff9f /django | |
| parent | 541000773a19d829a46fd4bec3655dca38a95551 (diff) | |
Fixed #25855 -- Enhanced the migration warning for runserver.
Added unapplied migration count and the list of unmigrated apps.
Diffstat (limited to 'django')
| -rw-r--r-- | django/core/management/commands/runserver.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/django/core/management/commands/runserver.py b/django/core/management/commands/runserver.py index 6d05fa8d6b..68de4ac6e5 100644 --- a/django/core/management/commands/runserver.py +++ b/django/core/management/commands/runserver.py @@ -172,9 +172,17 @@ class Command(BaseCommand): plan = executor.migration_plan(executor.loader.graph.leaf_nodes()) if plan: - self.stdout.write(self.style.NOTICE( - "\nYou have unapplied migrations; your app may not work properly until they are applied." - )) + apps_waiting_migration = sorted(set(migration.app_label for migration, backwards in plan)) + self.stdout.write( + self.style.NOTICE( + "\nYou have %(unpplied_migration_count)s unapplied migration(s). " + "Your project may not work properly until you apply the " + "migrations for app(s): %(apps_waiting_migration)s." % { + "unpplied_migration_count": len(plan), + "apps_waiting_migration": ", ".join(apps_waiting_migration), + } + ) + ) self.stdout.write(self.style.NOTICE("Run 'python manage.py migrate' to apply them.\n")) # Kept for backward compatibility |
