Fix "OK" alignment in migrate output

This commit is contained in:
Andrew Godwin 2013-07-26 16:52:17 +01:00
parent 52643a69e3
commit d5ca169334
2 changed files with 10 additions and 4 deletions

View File

@ -116,15 +116,15 @@ class Command(BaseCommand):
def migration_progress_callback(self, action, migration): def migration_progress_callback(self, action, migration):
if self.verbosity >= 1: if self.verbosity >= 1:
if action == "apply_start": if action == "apply_start":
self.stdout.write(" Applying %s... " % migration) self.stdout.write(" Applying %s..." % migration, ending="")
self.stdout.flush() self.stdout.flush()
elif action == "apply_success": elif action == "apply_success":
self.stdout.write(" OK\n") self.stdout.write(self.style.MIGRATE_SUCCESS(" OK"))
elif action == "unapply_start": elif action == "unapply_start":
self.stdout.write(" Unapplying %s... " % migration) self.stdout.write(" Unapplying %s..." % migration, ending="")
self.stdout.flush() self.stdout.flush()
elif action == "unapply_success": elif action == "unapply_success":
self.stdout.write(" OK\n") self.stdout.write(self.style.MIGRATE_SUCCESS(" OK"))
def sync_apps(self, connection, apps): def sync_apps(self, connection, apps):
"Runs the old syncdb-style operation on a list of apps." "Runs the old syncdb-style operation on a list of apps."

View File

@ -88,6 +88,8 @@ PALETTES = {
'HTTP_SERVER_ERROR': {}, 'HTTP_SERVER_ERROR': {},
'MIGRATE_HEADING': {}, 'MIGRATE_HEADING': {},
'MIGRATE_LABEL': {}, 'MIGRATE_LABEL': {},
'MIGRATE_SUCCESS': {},
'MIGRATE_FAILURE': {},
}, },
DARK_PALETTE: { DARK_PALETTE: {
'ERROR': { 'fg': 'red', 'opts': ('bold',) }, 'ERROR': { 'fg': 'red', 'opts': ('bold',) },
@ -105,6 +107,8 @@ PALETTES = {
'HTTP_SERVER_ERROR': { 'fg': 'magenta', 'opts': ('bold',) }, 'HTTP_SERVER_ERROR': { 'fg': 'magenta', 'opts': ('bold',) },
'MIGRATE_HEADING': { 'fg': 'cyan', 'opts': ('bold',) }, 'MIGRATE_HEADING': { 'fg': 'cyan', 'opts': ('bold',) },
'MIGRATE_LABEL': { 'opts': ('bold',) }, 'MIGRATE_LABEL': { 'opts': ('bold',) },
'MIGRATE_SUCCESS': { 'fg': 'green', 'opts': ('bold',) },
'MIGRATE_FAILURE': { 'fg': 'red', 'opts': ('bold',) },
}, },
LIGHT_PALETTE: { LIGHT_PALETTE: {
'ERROR': { 'fg': 'red', 'opts': ('bold',) }, 'ERROR': { 'fg': 'red', 'opts': ('bold',) },
@ -122,6 +126,8 @@ PALETTES = {
'HTTP_SERVER_ERROR': { 'fg': 'magenta', 'opts': ('bold',) }, 'HTTP_SERVER_ERROR': { 'fg': 'magenta', 'opts': ('bold',) },
'MIGRATE_HEADING': { 'fg': 'cyan', 'opts': ('bold',) }, 'MIGRATE_HEADING': { 'fg': 'cyan', 'opts': ('bold',) },
'MIGRATE_LABEL': { 'opts': ('bold',) }, 'MIGRATE_LABEL': { 'opts': ('bold',) },
'MIGRATE_SUCCESS': { 'fg': 'green', 'opts': ('bold',) },
'MIGRATE_FAILURE': { 'fg': 'red', 'opts': ('bold',) },
} }
} }
DEFAULT_PALETTE = DARK_PALETTE DEFAULT_PALETTE = DARK_PALETTE