<s> """<STR_LIT>""" <EOL> from django . core . validators import RegexValidator <EOL> from django . db . models import CharField <EOL> try : <EOL> from south . modelsinspector import add_introspection_rules <EOL> except ImportError : <EOL> pass <EOL> else : <EOL> add_introspection_rules ( [ ] , [ "<STR_LIT>" ] ) <EOL> from . widgets import ColorPickerWidget <EOL> class ColorField ( CharField ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , * args , ** kwargs ) : <EOL> kwargs [ '<STR_LIT:max_length>' ] = <NUM_LIT:6> <EOL> super ( ColorField , self ) . __init__ ( * args , ** kwargs ) <EOL> self . validators . append ( RegexValidator ( <EOL> regex = '<STR_LIT>' , <EOL> message = '<STR_LIT>' , <EOL> code = '<STR_LIT>' ) ) <EOL> def formfield ( self , ** kwargs ) : <EOL> kwargs [ '<STR_LIT>' ] = ColorPickerWidget <EOL> return super ( ColorField , self ) . formfield ( ** kwargs ) </s>
