From d5ca1693341daccce9b0dd8504967a56b289d92f Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Fri, 26 Jul 2013 16:52:17 +0100 Subject: [PATCH] Fix "OK" alignment in migrate output --- django/core/management/commands/migrate.py | 8 ++++---- django/utils/termcolors.py | 6 ++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/django/core/management/commands/migrate.py b/django/core/management/commands/migrate.py index 73d453cf99..d9a677e567 100644 --- a/django/core/management/commands/migrate.py +++ b/django/core/management/commands/migrate.py @@ -116,15 +116,15 @@ class Command(BaseCommand): def migration_progress_callback(self, action, migration): if self.verbosity >= 1: if action == "apply_start": - self.stdout.write(" Applying %s... " % migration) + self.stdout.write(" Applying %s..." % migration, ending="") self.stdout.flush() elif action == "apply_success": - self.stdout.write(" OK\n") + self.stdout.write(self.style.MIGRATE_SUCCESS(" OK")) elif action == "unapply_start": - self.stdout.write(" Unapplying %s... " % migration) + self.stdout.write(" Unapplying %s..." % migration, ending="") self.stdout.flush() elif action == "unapply_success": - self.stdout.write(" OK\n") + self.stdout.write(self.style.MIGRATE_SUCCESS(" OK")) def sync_apps(self, connection, apps): "Runs the old syncdb-style operation on a list of apps." diff --git a/django/utils/termcolors.py b/django/utils/termcolors.py index 3562fa4fb5..95d0d17f0f 100644 --- a/django/utils/termcolors.py +++ b/django/utils/termcolors.py @@ -88,6 +88,8 @@ PALETTES = { 'HTTP_SERVER_ERROR': {}, 'MIGRATE_HEADING': {}, 'MIGRATE_LABEL': {}, + 'MIGRATE_SUCCESS': {}, + 'MIGRATE_FAILURE': {}, }, DARK_PALETTE: { 'ERROR': { 'fg': 'red', 'opts': ('bold',) }, @@ -105,6 +107,8 @@ PALETTES = { 'HTTP_SERVER_ERROR': { 'fg': 'magenta', 'opts': ('bold',) }, 'MIGRATE_HEADING': { 'fg': 'cyan', 'opts': ('bold',) }, 'MIGRATE_LABEL': { 'opts': ('bold',) }, + 'MIGRATE_SUCCESS': { 'fg': 'green', 'opts': ('bold',) }, + 'MIGRATE_FAILURE': { 'fg': 'red', 'opts': ('bold',) }, }, LIGHT_PALETTE: { 'ERROR': { 'fg': 'red', 'opts': ('bold',) }, @@ -122,6 +126,8 @@ PALETTES = { 'HTTP_SERVER_ERROR': { 'fg': 'magenta', 'opts': ('bold',) }, 'MIGRATE_HEADING': { 'fg': 'cyan', 'opts': ('bold',) }, 'MIGRATE_LABEL': { 'opts': ('bold',) }, + 'MIGRATE_SUCCESS': { 'fg': 'green', 'opts': ('bold',) }, + 'MIGRATE_FAILURE': { 'fg': 'red', 'opts': ('bold',) }, } } DEFAULT_PALETTE = DARK_PALETTE