Commits

Germán M. Bravo committed 3a364da

Improve output style and show working field in color during prompt

Comments (0)

Files changed (1)

south/creator/actions.py

 
 from django.db.models.fields.related import RECURSIVE_RELATIONSHIP_CONSTANT
 from django.db.models.fields import FieldDoesNotExist, NOT_PROVIDED, CharField, TextField
+from django.core.management.color import color_style
 
 from south.modelsinspector import value_clean
 from south.creator.freezer import remove_useless_attributes, model_key
 from south.utils import datetime_utils
 from south.utils.py3 import raw_input
 
+style = color_style()
+
 
 class Action(object):
     """
             return
         # Oh dear. Ask them what to do.
         print(" ? The field '%s.%s' does not have a default specified, yet is NOT NULL." % (
-            self.model._meta.object_name,
-            field.name,
+            style.SQL_FIELD('%s.%s' % (self.model._meta.object_name, field.name)),
         ))
         print(" ? Since you are %s, you MUST specify a default" % self.null_reason)
         print(" ? value to use for existing rows. Would you like to:")
     
     FORWARDS_TEMPLATE = BACKWARDS_TEMPLATE = '''
         # Changing field '%(model_name)s.%(field_name)s'
-        db.alter_column(%(table_name)r, %(field_column)r, %(field_def)s)'''
+        db.alter_column(%(table_name)r, %(field_column)r, %(field_def)s)'''[1:] + "\n"
     
     RENAME_TEMPLATE = '''
         # Renaming column for '%(model_name)s.%(field_name)s' to match new field type.
-        db.rename_column(%(table_name)r, %(old_column)r, %(new_column)r)'''
+        db.rename_column(%(table_name)r, %(old_column)r, %(new_column)r)'''[1:] + "\n"
     
     def __init__(self, model, old_field, new_field, old_def, new_def):
         self.model = model