mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Introduce ColorField for consistent represention of color choice fields in forms
This commit is contained in:
@ -20,6 +20,7 @@ from .constants import *
|
||||
from .utils import expand_alphanumeric_pattern, expand_ipaddress_pattern
|
||||
|
||||
__all__ = (
|
||||
'ColorField',
|
||||
'CommentField',
|
||||
'ContentTypeChoiceField',
|
||||
'ContentTypeMultipleChoiceField',
|
||||
@ -69,6 +70,13 @@ class SlugField(forms.SlugField):
|
||||
self.widget.attrs['slug-source'] = slug_source
|
||||
|
||||
|
||||
class ColorField(forms.CharField):
|
||||
"""
|
||||
A field which represents a color in hexadecimal RRGGBB format.
|
||||
"""
|
||||
widget = widgets.ColorSelect
|
||||
|
||||
|
||||
class TagFilterField(forms.MultipleChoiceField):
|
||||
"""
|
||||
A filter field for the tags of a model. Only the tags used by a model are displayed.
|
||||
|
Reference in New Issue
Block a user