23
23
from tenancy .models import Tenant
24
24
from utilities .forms import (
25
25
APISelect , APISelectMultiple , add_blank_choice , BootstrapMixin , BulkEditForm , BulkEditNullBooleanSelect ,
26
- ColorSelect , CommentField , CSVChoiceField , CSVContentTypeField , CSVModelChoiceField , CSVTypedChoiceField ,
26
+ ColorField , CommentField , CSVChoiceField , CSVContentTypeField , CSVModelChoiceField , CSVTypedChoiceField ,
27
27
DynamicModelChoiceField , DynamicModelMultipleChoiceField , ExpandableNameField , form_from_model , JSONField ,
28
28
NumericArrayField , SelectWithPK , SmallTextarea , SlugField , StaticSelect2 , StaticSelect2Multiple , TagFilterField ,
29
29
BOOLEAN_WITH_BLANK_CHOICES ,
@@ -610,10 +610,8 @@ class RackRoleBulkEditForm(BootstrapMixin, CustomFieldBulkEditForm):
610
610
queryset = RackRole .objects .all (),
611
611
widget = forms .MultipleHiddenInput
612
612
)
613
- color = forms .CharField (
614
- max_length = 6 , # RGB color code
615
- required = False ,
616
- widget = ColorSelect ()
613
+ color = ColorField (
614
+ required = False
617
615
)
618
616
description = forms .CharField (
619
617
max_length = 200 ,
@@ -1703,10 +1701,8 @@ class FrontPortTemplateBulkEditForm(BootstrapMixin, BulkEditForm):
1703
1701
required = False ,
1704
1702
widget = StaticSelect2 ()
1705
1703
)
1706
- color = forms .CharField (
1707
- max_length = 6 , # RGB color code
1708
- required = False ,
1709
- widget = ColorSelect ()
1704
+ color = ColorField (
1705
+ required = False
1710
1706
)
1711
1707
description = forms .CharField (
1712
1708
required = False
@@ -1734,10 +1730,8 @@ class RearPortTemplateCreateForm(ComponentTemplateCreateForm):
1734
1730
choices = PortTypeChoices ,
1735
1731
widget = StaticSelect2 (),
1736
1732
)
1737
- color = forms .CharField (
1738
- max_length = 6 , # RGB color code
1739
- required = False ,
1740
- widget = ColorSelect ()
1733
+ color = ColorField (
1734
+ required = False
1741
1735
)
1742
1736
positions = forms .IntegerField (
1743
1737
min_value = REARPORT_POSITIONS_MIN ,
@@ -1764,10 +1758,8 @@ class RearPortTemplateBulkEditForm(BootstrapMixin, BulkEditForm):
1764
1758
required = False ,
1765
1759
widget = StaticSelect2 ()
1766
1760
)
1767
- color = forms .CharField (
1768
- max_length = 6 , # RGB color code
1769
- required = False ,
1770
- widget = ColorSelect ()
1761
+ color = ColorField (
1762
+ required = False
1771
1763
)
1772
1764
description = forms .CharField (
1773
1765
required = False
@@ -1958,10 +1950,8 @@ class DeviceRoleBulkEditForm(BootstrapMixin, CustomFieldBulkEditForm):
1958
1950
queryset = DeviceRole .objects .all (),
1959
1951
widget = forms .MultipleHiddenInput
1960
1952
)
1961
- color = forms .CharField (
1962
- max_length = 6 , # RGB color code
1963
- required = False ,
1964
- widget = ColorSelect ()
1953
+ color = ColorField (
1954
+ required = False
1965
1955
)
1966
1956
vm_role = forms .NullBooleanField (
1967
1957
required = False ,
@@ -3454,10 +3444,8 @@ class FrontPortFilterForm(DeviceComponentFilterForm):
3454
3444
required = False ,
3455
3445
widget = StaticSelect2Multiple ()
3456
3446
)
3457
- color = forms .CharField (
3458
- max_length = 6 , # RGB color code
3459
- required = False ,
3460
- widget = ColorSelect ()
3447
+ color = ColorField (
3448
+ required = False
3461
3449
)
3462
3450
tag = TagFilterField (model )
3463
3451
@@ -3497,10 +3485,8 @@ class FrontPortCreateForm(ComponentCreateForm):
3497
3485
choices = PortTypeChoices ,
3498
3486
widget = StaticSelect2 (),
3499
3487
)
3500
- color = forms .CharField (
3501
- max_length = 6 , # RGB color code
3502
- required = False ,
3503
- widget = ColorSelect ()
3488
+ color = ColorField (
3489
+ required = False
3504
3490
)
3505
3491
rear_port_set = forms .MultipleChoiceField (
3506
3492
choices = [],
@@ -3646,10 +3632,8 @@ class RearPortFilterForm(DeviceComponentFilterForm):
3646
3632
required = False ,
3647
3633
widget = StaticSelect2Multiple ()
3648
3634
)
3649
- color = forms .CharField (
3650
- max_length = 6 , # RGB color code
3651
- required = False ,
3652
- widget = ColorSelect ()
3635
+ color = ColorField (
3636
+ required = False
3653
3637
)
3654
3638
tag = TagFilterField (model )
3655
3639
@@ -3677,10 +3661,8 @@ class RearPortCreateForm(ComponentCreateForm):
3677
3661
choices = PortTypeChoices ,
3678
3662
widget = StaticSelect2 (),
3679
3663
)
3680
- color = forms .CharField (
3681
- max_length = 6 , # RGB color code
3682
- required = False ,
3683
- widget = ColorSelect ()
3664
+ color = ColorField (
3665
+ required = False
3684
3666
)
3685
3667
positions = forms .IntegerField (
3686
3668
min_value = REARPORT_POSITIONS_MIN ,
@@ -4411,10 +4393,8 @@ class CableBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldBulkEditFo
4411
4393
max_length = 100 ,
4412
4394
required = False
4413
4395
)
4414
- color = forms .CharField (
4415
- max_length = 6 , # RGB color code
4416
- required = False ,
4417
- widget = ColorSelect ()
4396
+ color = ColorField (
4397
+ required = False
4418
4398
)
4419
4399
length = forms .IntegerField (
4420
4400
min_value = 1 ,
@@ -4489,10 +4469,8 @@ class CableFilterForm(BootstrapMixin, CustomFieldFilterForm):
4489
4469
choices = add_blank_choice (CableStatusChoices ),
4490
4470
widget = StaticSelect2 ()
4491
4471
)
4492
- color = forms .CharField (
4493
- max_length = 6 , # RGB color code
4494
- required = False ,
4495
- widget = ColorSelect ()
4472
+ color = ColorField (
4473
+ required = False
4496
4474
)
4497
4475
device_id = DynamicModelMultipleChoiceField (
4498
4476
queryset = Device .objects .all (),
0 commit comments