django_auxilium.forms.color module

class django_auxilium.forms.color.ColorCharField(*args, **kwargs)[source]

Bases: django.forms.fields.CharField

Custom django field which is able to validate colors as input.

Parameters:type (str) –

The type of the color format. The supported formats are

hex:

The hexadecimal notation of the color. Examples is:

ff0000
#00ff00

This type also allows to specify these additional parameters:

hash_required : bool

If the # is required in the value (e.g. '#ff0000')

hash_output : bool

If the # is required in the output validated value in to_python

Raises:ValueError – If unsupported type color type is provided
default_error_messages = {u'invalid': u'Invalid color value.'}
to_python(value)[source]

Convert to a validated string color value.