mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-16 12:12:53 -06:00
#6372: Refactor Select2 naming
This commit is contained in:
parent
29ee3e5ac0
commit
c14b546d5f
@ -11,7 +11,7 @@ from tenancy.models import Tenant
|
||||
from utilities.forms import (
|
||||
add_blank_choice, BootstrapMixin, CommentField, CSVChoiceField, CSVModelChoiceField, DatePicker,
|
||||
DynamicModelChoiceField, DynamicModelMultipleChoiceField, SelectSpeedWidget, SmallTextarea, SlugField,
|
||||
StaticSelect2, StaticSelect2Multiple, TagFilterField,
|
||||
StaticSelect, StaticSelectMultiple, TagFilterField,
|
||||
)
|
||||
from .choices import CircuitStatusChoices
|
||||
from .models import *
|
||||
@ -274,7 +274,7 @@ class CircuitForm(BootstrapMixin, TenancyForm, CustomFieldModelForm):
|
||||
'commit_rate': "Committed rate",
|
||||
}
|
||||
widgets = {
|
||||
'status': StaticSelect2(),
|
||||
'status': StaticSelect(),
|
||||
'install_date': DatePicker(),
|
||||
'commit_rate': SelectSpeedWidget(),
|
||||
}
|
||||
@ -327,7 +327,7 @@ class CircuitBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldModelBul
|
||||
choices=add_blank_choice(CircuitStatusChoices),
|
||||
required=False,
|
||||
initial='',
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
tenant = DynamicModelChoiceField(
|
||||
queryset=Tenant.objects.all(),
|
||||
@ -386,7 +386,7 @@ class CircuitFilterForm(BootstrapMixin, TenancyFilterForm, CustomFieldModelFilte
|
||||
status = forms.MultipleChoiceField(
|
||||
choices=CircuitStatusChoices,
|
||||
required=False,
|
||||
widget=StaticSelect2Multiple()
|
||||
widget=StaticSelectMultiple()
|
||||
)
|
||||
region_id = DynamicModelMultipleChoiceField(
|
||||
queryset=Region.objects.all(),
|
||||
|
@ -25,7 +25,7 @@ from utilities.forms import (
|
||||
APISelect, APISelectMultiple, add_blank_choice, BootstrapMixin, BulkEditForm, BulkEditNullBooleanSelect,
|
||||
ColorField, CommentField, CSVChoiceField, CSVContentTypeField, CSVModelChoiceField, CSVTypedChoiceField,
|
||||
DynamicModelChoiceField, DynamicModelMultipleChoiceField, ExpandableNameField, form_from_model, JSONField,
|
||||
NumericArrayField, SelectWithPK, SmallTextarea, SlugField, StaticSelect2, StaticSelect2Multiple, TagFilterField,
|
||||
NumericArrayField, SelectWithPK, SmallTextarea, SlugField, StaticSelect, StaticSelectMultiple, TagFilterField,
|
||||
BOOLEAN_WITH_BLANK_CHOICES,
|
||||
)
|
||||
from virtualization.models import Cluster, ClusterGroup
|
||||
@ -304,7 +304,7 @@ class SiteForm(BootstrapMixin, TenancyForm, CustomFieldModelForm):
|
||||
time_zone = TimeZoneFormField(
|
||||
choices=add_blank_choice(TimeZoneFormField().choices),
|
||||
required=False,
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
comments = CommentField()
|
||||
tags = DynamicModelMultipleChoiceField(
|
||||
@ -340,8 +340,8 @@ class SiteForm(BootstrapMixin, TenancyForm, CustomFieldModelForm):
|
||||
'rows': 3,
|
||||
}
|
||||
),
|
||||
'status': StaticSelect2(),
|
||||
'time_zone': StaticSelect2(),
|
||||
'status': StaticSelect(),
|
||||
'time_zone': StaticSelect(),
|
||||
}
|
||||
help_texts = {
|
||||
'name': "Full name of the site",
|
||||
@ -404,7 +404,7 @@ class SiteBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldModelBulkEd
|
||||
choices=add_blank_choice(SiteStatusChoices),
|
||||
required=False,
|
||||
initial='',
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
region = DynamicModelChoiceField(
|
||||
queryset=Region.objects.all(),
|
||||
@ -431,7 +431,7 @@ class SiteBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldModelBulkEd
|
||||
time_zone = TimeZoneFormField(
|
||||
choices=add_blank_choice(TimeZoneFormField().choices),
|
||||
required=False,
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@ -451,7 +451,7 @@ class SiteFilterForm(BootstrapMixin, TenancyFilterForm, CustomFieldModelFilterFo
|
||||
status = forms.MultipleChoiceField(
|
||||
choices=SiteStatusChoices,
|
||||
required=False,
|
||||
widget=StaticSelect2Multiple()
|
||||
widget=StaticSelectMultiple()
|
||||
)
|
||||
region_id = DynamicModelMultipleChoiceField(
|
||||
queryset=Region.objects.all(),
|
||||
@ -679,10 +679,10 @@ class RackForm(BootstrapMixin, TenancyForm, CustomFieldModelForm):
|
||||
'u_height': "Height in rack units",
|
||||
}
|
||||
widgets = {
|
||||
'status': StaticSelect2(),
|
||||
'type': StaticSelect2(),
|
||||
'width': StaticSelect2(),
|
||||
'outer_unit': StaticSelect2(),
|
||||
'status': StaticSelect(),
|
||||
'type': StaticSelect(),
|
||||
'width': StaticSelect(),
|
||||
'outer_unit': StaticSelect(),
|
||||
}
|
||||
|
||||
|
||||
@ -787,7 +787,7 @@ class RackBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldModelBulkEd
|
||||
choices=add_blank_choice(RackStatusChoices),
|
||||
required=False,
|
||||
initial='',
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
role = DynamicModelChoiceField(
|
||||
queryset=RackRole.objects.all(),
|
||||
@ -805,12 +805,12 @@ class RackBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldModelBulkEd
|
||||
type = forms.ChoiceField(
|
||||
choices=add_blank_choice(RackTypeChoices),
|
||||
required=False,
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
width = forms.ChoiceField(
|
||||
choices=add_blank_choice(RackWidthChoices),
|
||||
required=False,
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
u_height = forms.IntegerField(
|
||||
required=False,
|
||||
@ -832,7 +832,7 @@ class RackBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldModelBulkEd
|
||||
outer_unit = forms.ChoiceField(
|
||||
choices=add_blank_choice(RackDimensionUnitChoices),
|
||||
required=False,
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
comments = CommentField(
|
||||
widget=SmallTextarea,
|
||||
@ -878,17 +878,17 @@ class RackFilterForm(BootstrapMixin, TenancyFilterForm, CustomFieldModelFilterFo
|
||||
status = forms.MultipleChoiceField(
|
||||
choices=RackStatusChoices,
|
||||
required=False,
|
||||
widget=StaticSelect2Multiple()
|
||||
widget=StaticSelectMultiple()
|
||||
)
|
||||
type = forms.MultipleChoiceField(
|
||||
choices=RackTypeChoices,
|
||||
required=False,
|
||||
widget=StaticSelect2Multiple()
|
||||
widget=StaticSelectMultiple()
|
||||
)
|
||||
width = forms.MultipleChoiceField(
|
||||
choices=RackWidthChoices,
|
||||
required=False,
|
||||
widget=StaticSelect2Multiple()
|
||||
widget=StaticSelectMultiple()
|
||||
)
|
||||
role_id = DynamicModelMultipleChoiceField(
|
||||
queryset=RackRole.objects.all(),
|
||||
@ -970,7 +970,7 @@ class RackReservationForm(BootstrapMixin, TenancyForm, CustomFieldModelForm):
|
||||
queryset=User.objects.order_by(
|
||||
'username'
|
||||
),
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
tags = DynamicModelMultipleChoiceField(
|
||||
queryset=Tag.objects.all(),
|
||||
@ -1049,7 +1049,7 @@ class RackReservationBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomField
|
||||
'username'
|
||||
),
|
||||
required=False,
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
tenant = DynamicModelChoiceField(
|
||||
queryset=Tenant.objects.all(),
|
||||
@ -1166,7 +1166,7 @@ class DeviceTypeForm(BootstrapMixin, CustomFieldModelForm):
|
||||
('Images', ('front_image', 'rear_image')),
|
||||
)
|
||||
widgets = {
|
||||
'subdevice_role': StaticSelect2(),
|
||||
'subdevice_role': StaticSelect(),
|
||||
'front_image': forms.ClearableFileInput(attrs={
|
||||
'accept': DEVICETYPE_IMAGE_FORMATS
|
||||
}),
|
||||
@ -1230,47 +1230,47 @@ class DeviceTypeFilterForm(BootstrapMixin, CustomFieldModelFilterForm):
|
||||
subdevice_role = forms.MultipleChoiceField(
|
||||
choices=add_blank_choice(SubdeviceRoleChoices),
|
||||
required=False,
|
||||
widget=StaticSelect2Multiple()
|
||||
widget=StaticSelectMultiple()
|
||||
)
|
||||
console_ports = forms.NullBooleanField(
|
||||
required=False,
|
||||
label='Has console ports',
|
||||
widget=StaticSelect2(
|
||||
widget=StaticSelect(
|
||||
choices=BOOLEAN_WITH_BLANK_CHOICES
|
||||
)
|
||||
)
|
||||
console_server_ports = forms.NullBooleanField(
|
||||
required=False,
|
||||
label='Has console server ports',
|
||||
widget=StaticSelect2(
|
||||
widget=StaticSelect(
|
||||
choices=BOOLEAN_WITH_BLANK_CHOICES
|
||||
)
|
||||
)
|
||||
power_ports = forms.NullBooleanField(
|
||||
required=False,
|
||||
label='Has power ports',
|
||||
widget=StaticSelect2(
|
||||
widget=StaticSelect(
|
||||
choices=BOOLEAN_WITH_BLANK_CHOICES
|
||||
)
|
||||
)
|
||||
power_outlets = forms.NullBooleanField(
|
||||
required=False,
|
||||
label='Has power outlets',
|
||||
widget=StaticSelect2(
|
||||
widget=StaticSelect(
|
||||
choices=BOOLEAN_WITH_BLANK_CHOICES
|
||||
)
|
||||
)
|
||||
interfaces = forms.NullBooleanField(
|
||||
required=False,
|
||||
label='Has interfaces',
|
||||
widget=StaticSelect2(
|
||||
widget=StaticSelect(
|
||||
choices=BOOLEAN_WITH_BLANK_CHOICES
|
||||
)
|
||||
)
|
||||
pass_through_ports = forms.NullBooleanField(
|
||||
required=False,
|
||||
label='Has pass-through ports',
|
||||
widget=StaticSelect2(
|
||||
widget=StaticSelect(
|
||||
choices=BOOLEAN_WITH_BLANK_CHOICES
|
||||
)
|
||||
)
|
||||
@ -1318,7 +1318,7 @@ class ConsolePortTemplateForm(BootstrapMixin, forms.ModelForm):
|
||||
class ConsolePortTemplateCreateForm(ComponentTemplateCreateForm):
|
||||
type = forms.ChoiceField(
|
||||
choices=add_blank_choice(ConsolePortTypeChoices),
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
field_order = ('manufacturer', 'device_type', 'name_pattern', 'label_pattern', 'type', 'description')
|
||||
|
||||
@ -1335,7 +1335,7 @@ class ConsolePortTemplateBulkEditForm(BootstrapMixin, BulkEditForm):
|
||||
type = forms.ChoiceField(
|
||||
choices=add_blank_choice(ConsolePortTypeChoices),
|
||||
required=False,
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@ -1357,7 +1357,7 @@ class ConsoleServerPortTemplateForm(BootstrapMixin, forms.ModelForm):
|
||||
class ConsoleServerPortTemplateCreateForm(ComponentTemplateCreateForm):
|
||||
type = forms.ChoiceField(
|
||||
choices=add_blank_choice(ConsolePortTypeChoices),
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
field_order = ('manufacturer', 'device_type', 'name_pattern', 'label_pattern', 'type', 'description')
|
||||
|
||||
@ -1374,7 +1374,7 @@ class ConsoleServerPortTemplateBulkEditForm(BootstrapMixin, BulkEditForm):
|
||||
type = forms.ChoiceField(
|
||||
choices=add_blank_choice(ConsolePortTypeChoices),
|
||||
required=False,
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
description = forms.CharField(
|
||||
required=False
|
||||
@ -1429,7 +1429,7 @@ class PowerPortTemplateBulkEditForm(BootstrapMixin, BulkEditForm):
|
||||
type = forms.ChoiceField(
|
||||
choices=add_blank_choice(PowerPortTypeChoices),
|
||||
required=False,
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
maximum_draw = forms.IntegerField(
|
||||
min_value=1,
|
||||
@ -1483,7 +1483,7 @@ class PowerOutletTemplateCreateForm(ComponentTemplateCreateForm):
|
||||
feed_leg = forms.ChoiceField(
|
||||
choices=add_blank_choice(PowerOutletFeedLegChoices),
|
||||
required=False,
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
field_order = (
|
||||
'manufacturer', 'device_type', 'name_pattern', 'label_pattern', 'type', 'power_port', 'feed_leg',
|
||||
@ -1520,7 +1520,7 @@ class PowerOutletTemplateBulkEditForm(BootstrapMixin, BulkEditForm):
|
||||
type = forms.ChoiceField(
|
||||
choices=add_blank_choice(PowerOutletTypeChoices),
|
||||
required=False,
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
power_port = forms.ModelChoiceField(
|
||||
queryset=PowerPortTemplate.objects.all(),
|
||||
@ -1529,7 +1529,7 @@ class PowerOutletTemplateBulkEditForm(BootstrapMixin, BulkEditForm):
|
||||
feed_leg = forms.ChoiceField(
|
||||
choices=add_blank_choice(PowerOutletFeedLegChoices),
|
||||
required=False,
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
description = forms.CharField(
|
||||
required=False
|
||||
@ -1559,14 +1559,14 @@ class InterfaceTemplateForm(BootstrapMixin, forms.ModelForm):
|
||||
]
|
||||
widgets = {
|
||||
'device_type': forms.HiddenInput(),
|
||||
'type': StaticSelect2(),
|
||||
'type': StaticSelect(),
|
||||
}
|
||||
|
||||
|
||||
class InterfaceTemplateCreateForm(ComponentTemplateCreateForm):
|
||||
type = forms.ChoiceField(
|
||||
choices=InterfaceTypeChoices,
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
mgmt_only = forms.BooleanField(
|
||||
required=False,
|
||||
@ -1587,7 +1587,7 @@ class InterfaceTemplateBulkEditForm(BootstrapMixin, BulkEditForm):
|
||||
type = forms.ChoiceField(
|
||||
choices=add_blank_choice(InterfaceTypeChoices),
|
||||
required=False,
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
mgmt_only = forms.NullBooleanField(
|
||||
required=False,
|
||||
@ -1611,7 +1611,7 @@ class FrontPortTemplateForm(BootstrapMixin, forms.ModelForm):
|
||||
]
|
||||
widgets = {
|
||||
'device_type': forms.HiddenInput(),
|
||||
'rear_port': StaticSelect2(),
|
||||
'rear_port': StaticSelect(),
|
||||
}
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
@ -1628,7 +1628,7 @@ class FrontPortTemplateForm(BootstrapMixin, forms.ModelForm):
|
||||
class FrontPortTemplateCreateForm(ComponentTemplateCreateForm):
|
||||
type = forms.ChoiceField(
|
||||
choices=PortTypeChoices,
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
rear_port_set = forms.MultipleChoiceField(
|
||||
choices=[],
|
||||
@ -1698,7 +1698,7 @@ class FrontPortTemplateBulkEditForm(BootstrapMixin, BulkEditForm):
|
||||
type = forms.ChoiceField(
|
||||
choices=add_blank_choice(PortTypeChoices),
|
||||
required=False,
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
color = ColorField(
|
||||
required=False
|
||||
@ -1720,14 +1720,14 @@ class RearPortTemplateForm(BootstrapMixin, forms.ModelForm):
|
||||
]
|
||||
widgets = {
|
||||
'device_type': forms.HiddenInput(),
|
||||
'type': StaticSelect2(),
|
||||
'type': StaticSelect(),
|
||||
}
|
||||
|
||||
|
||||
class RearPortTemplateCreateForm(ComponentTemplateCreateForm):
|
||||
type = forms.ChoiceField(
|
||||
choices=PortTypeChoices,
|
||||
widget=StaticSelect2(),
|
||||
widget=StaticSelect(),
|
||||
)
|
||||
color = ColorField(
|
||||
required=False
|
||||
@ -1755,7 +1755,7 @@ class RearPortTemplateBulkEditForm(BootstrapMixin, BulkEditForm):
|
||||
type = forms.ChoiceField(
|
||||
choices=add_blank_choice(PortTypeChoices),
|
||||
required=False,
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
color = ColorField(
|
||||
required=False
|
||||
@ -2142,10 +2142,10 @@ class DeviceForm(BootstrapMixin, TenancyForm, CustomFieldModelForm):
|
||||
"config context",
|
||||
}
|
||||
widgets = {
|
||||
'face': StaticSelect2(),
|
||||
'status': StaticSelect2(),
|
||||
'primary_ip4': StaticSelect2(),
|
||||
'primary_ip6': StaticSelect2(),
|
||||
'face': StaticSelect(),
|
||||
'status': StaticSelect(),
|
||||
'primary_ip4': StaticSelect(),
|
||||
'primary_ip6': StaticSelect(),
|
||||
}
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
@ -2405,7 +2405,7 @@ class DeviceBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldModelBulk
|
||||
status = forms.ChoiceField(
|
||||
choices=add_blank_choice(DeviceStatusChoices),
|
||||
required=False,
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
serial = forms.CharField(
|
||||
max_length=50,
|
||||
@ -2491,7 +2491,7 @@ class DeviceFilterForm(BootstrapMixin, LocalConfigContextFilterForm, TenancyFilt
|
||||
status = forms.MultipleChoiceField(
|
||||
choices=DeviceStatusChoices,
|
||||
required=False,
|
||||
widget=StaticSelect2Multiple()
|
||||
widget=StaticSelectMultiple()
|
||||
)
|
||||
asset_tag = forms.CharField(
|
||||
required=False
|
||||
@ -2503,56 +2503,56 @@ class DeviceFilterForm(BootstrapMixin, LocalConfigContextFilterForm, TenancyFilt
|
||||
has_primary_ip = forms.NullBooleanField(
|
||||
required=False,
|
||||
label='Has a primary IP',
|
||||
widget=StaticSelect2(
|
||||
widget=StaticSelect(
|
||||
choices=BOOLEAN_WITH_BLANK_CHOICES
|
||||
)
|
||||
)
|
||||
virtual_chassis_member = forms.NullBooleanField(
|
||||
required=False,
|
||||
label='Virtual chassis member',
|
||||
widget=StaticSelect2(
|
||||
widget=StaticSelect(
|
||||
choices=BOOLEAN_WITH_BLANK_CHOICES
|
||||
)
|
||||
)
|
||||
console_ports = forms.NullBooleanField(
|
||||
required=False,
|
||||
label='Has console ports',
|
||||
widget=StaticSelect2(
|
||||
widget=StaticSelect(
|
||||
choices=BOOLEAN_WITH_BLANK_CHOICES
|
||||
)
|
||||
)
|
||||
console_server_ports = forms.NullBooleanField(
|
||||
required=False,
|
||||
label='Has console server ports',
|
||||
widget=StaticSelect2(
|
||||
widget=StaticSelect(
|
||||
choices=BOOLEAN_WITH_BLANK_CHOICES
|
||||
)
|
||||
)
|
||||
power_ports = forms.NullBooleanField(
|
||||
required=False,
|
||||
label='Has power ports',
|
||||
widget=StaticSelect2(
|
||||
widget=StaticSelect(
|
||||
choices=BOOLEAN_WITH_BLANK_CHOICES
|
||||
)
|
||||
)
|
||||
power_outlets = forms.NullBooleanField(
|
||||
required=False,
|
||||
label='Has power outlets',
|
||||
widget=StaticSelect2(
|
||||
widget=StaticSelect(
|
||||
choices=BOOLEAN_WITH_BLANK_CHOICES
|
||||
)
|
||||
)
|
||||
interfaces = forms.NullBooleanField(
|
||||
required=False,
|
||||
label='Has interfaces',
|
||||
widget=StaticSelect2(
|
||||
widget=StaticSelect(
|
||||
choices=BOOLEAN_WITH_BLANK_CHOICES
|
||||
)
|
||||
)
|
||||
pass_through_ports = forms.NullBooleanField(
|
||||
required=False,
|
||||
label='Has pass-through ports',
|
||||
widget=StaticSelect2(
|
||||
widget=StaticSelect(
|
||||
choices=BOOLEAN_WITH_BLANK_CHOICES
|
||||
)
|
||||
)
|
||||
@ -2611,12 +2611,12 @@ class ConsolePortFilterForm(DeviceComponentFilterForm):
|
||||
type = forms.MultipleChoiceField(
|
||||
choices=ConsolePortTypeChoices,
|
||||
required=False,
|
||||
widget=StaticSelect2Multiple()
|
||||
widget=StaticSelectMultiple()
|
||||
)
|
||||
speed = forms.MultipleChoiceField(
|
||||
choices=ConsolePortSpeedChoices,
|
||||
required=False,
|
||||
widget=StaticSelect2Multiple()
|
||||
widget=StaticSelectMultiple()
|
||||
)
|
||||
tag = TagFilterField(model)
|
||||
|
||||
@ -2642,12 +2642,12 @@ class ConsolePortCreateForm(ComponentCreateForm):
|
||||
type = forms.ChoiceField(
|
||||
choices=add_blank_choice(ConsolePortTypeChoices),
|
||||
required=False,
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
speed = forms.ChoiceField(
|
||||
choices=add_blank_choice(ConsolePortSpeedChoices),
|
||||
required=False,
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
field_order = ('device', 'name_pattern', 'label_pattern', 'type', 'speed', 'mark_connected', 'description', 'tags')
|
||||
|
||||
@ -2718,12 +2718,12 @@ class ConsoleServerPortFilterForm(DeviceComponentFilterForm):
|
||||
type = forms.MultipleChoiceField(
|
||||
choices=ConsolePortTypeChoices,
|
||||
required=False,
|
||||
widget=StaticSelect2Multiple()
|
||||
widget=StaticSelectMultiple()
|
||||
)
|
||||
speed = forms.MultipleChoiceField(
|
||||
choices=ConsolePortSpeedChoices,
|
||||
required=False,
|
||||
widget=StaticSelect2Multiple()
|
||||
widget=StaticSelectMultiple()
|
||||
)
|
||||
tag = TagFilterField(model)
|
||||
|
||||
@ -2749,12 +2749,12 @@ class ConsoleServerPortCreateForm(ComponentCreateForm):
|
||||
type = forms.ChoiceField(
|
||||
choices=add_blank_choice(ConsolePortTypeChoices),
|
||||
required=False,
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
speed = forms.ChoiceField(
|
||||
choices=add_blank_choice(ConsolePortSpeedChoices),
|
||||
required=False,
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
field_order = ('device', 'name_pattern', 'label_pattern', 'type', 'speed', 'mark_connected', 'description', 'tags')
|
||||
|
||||
@ -2824,7 +2824,7 @@ class PowerPortFilterForm(DeviceComponentFilterForm):
|
||||
type = forms.MultipleChoiceField(
|
||||
choices=PowerPortTypeChoices,
|
||||
required=False,
|
||||
widget=StaticSelect2Multiple()
|
||||
widget=StaticSelectMultiple()
|
||||
)
|
||||
tag = TagFilterField(model)
|
||||
|
||||
@ -2851,7 +2851,7 @@ class PowerPortCreateForm(ComponentCreateForm):
|
||||
type = forms.ChoiceField(
|
||||
choices=add_blank_choice(PowerPortTypeChoices),
|
||||
required=False,
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
maximum_draw = forms.IntegerField(
|
||||
min_value=1,
|
||||
@ -2929,7 +2929,7 @@ class PowerOutletFilterForm(DeviceComponentFilterForm):
|
||||
type = forms.MultipleChoiceField(
|
||||
choices=PowerOutletTypeChoices,
|
||||
required=False,
|
||||
widget=StaticSelect2Multiple()
|
||||
widget=StaticSelectMultiple()
|
||||
)
|
||||
tag = TagFilterField(model)
|
||||
|
||||
@ -2968,7 +2968,7 @@ class PowerOutletCreateForm(ComponentCreateForm):
|
||||
type = forms.ChoiceField(
|
||||
choices=add_blank_choice(PowerOutletTypeChoices),
|
||||
required=False,
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
power_port = forms.ModelChoiceField(
|
||||
queryset=PowerPort.objects.all(),
|
||||
@ -3102,17 +3102,17 @@ class InterfaceFilterForm(DeviceComponentFilterForm):
|
||||
type = forms.MultipleChoiceField(
|
||||
choices=InterfaceTypeChoices,
|
||||
required=False,
|
||||
widget=StaticSelect2Multiple()
|
||||
widget=StaticSelectMultiple()
|
||||
)
|
||||
enabled = forms.NullBooleanField(
|
||||
required=False,
|
||||
widget=StaticSelect2(
|
||||
widget=StaticSelect(
|
||||
choices=BOOLEAN_WITH_BLANK_CHOICES
|
||||
)
|
||||
)
|
||||
mgmt_only = forms.NullBooleanField(
|
||||
required=False,
|
||||
widget=StaticSelect2(
|
||||
widget=StaticSelect(
|
||||
choices=BOOLEAN_WITH_BLANK_CHOICES
|
||||
)
|
||||
)
|
||||
@ -3160,8 +3160,8 @@ class InterfaceForm(BootstrapMixin, InterfaceCommonForm, CustomFieldModelForm):
|
||||
]
|
||||
widgets = {
|
||||
'device': forms.HiddenInput(),
|
||||
'type': StaticSelect2(),
|
||||
'mode': StaticSelect2(),
|
||||
'type': StaticSelect(),
|
||||
'mode': StaticSelect(),
|
||||
}
|
||||
labels = {
|
||||
'mode': '802.1Q Mode',
|
||||
@ -3192,7 +3192,7 @@ class InterfaceCreateForm(ComponentCreateForm, InterfaceCommonForm):
|
||||
model = Interface
|
||||
type = forms.ChoiceField(
|
||||
choices=InterfaceTypeChoices,
|
||||
widget=StaticSelect2(),
|
||||
widget=StaticSelect(),
|
||||
)
|
||||
enabled = forms.BooleanField(
|
||||
required=False,
|
||||
@ -3231,7 +3231,7 @@ class InterfaceCreateForm(ComponentCreateForm, InterfaceCommonForm):
|
||||
mode = forms.ChoiceField(
|
||||
choices=add_blank_choice(InterfaceModeChoices),
|
||||
required=False,
|
||||
widget=StaticSelect2(),
|
||||
widget=StaticSelect(),
|
||||
)
|
||||
untagged_vlan = DynamicModelChoiceField(
|
||||
queryset=VLAN.objects.all(),
|
||||
@ -3451,7 +3451,7 @@ class FrontPortFilterForm(DeviceComponentFilterForm):
|
||||
type = forms.MultipleChoiceField(
|
||||
choices=PortTypeChoices,
|
||||
required=False,
|
||||
widget=StaticSelect2Multiple()
|
||||
widget=StaticSelectMultiple()
|
||||
)
|
||||
color = ColorField(
|
||||
required=False
|
||||
@ -3473,8 +3473,8 @@ class FrontPortForm(BootstrapMixin, CustomFieldModelForm):
|
||||
]
|
||||
widgets = {
|
||||
'device': forms.HiddenInput(),
|
||||
'type': StaticSelect2(),
|
||||
'rear_port': StaticSelect2(),
|
||||
'type': StaticSelect(),
|
||||
'rear_port': StaticSelect(),
|
||||
}
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
@ -3492,7 +3492,7 @@ class FrontPortCreateForm(ComponentCreateForm):
|
||||
model = FrontPort
|
||||
type = forms.ChoiceField(
|
||||
choices=PortTypeChoices,
|
||||
widget=StaticSelect2(),
|
||||
widget=StaticSelect(),
|
||||
)
|
||||
color = ColorField(
|
||||
required=False
|
||||
@ -3639,7 +3639,7 @@ class RearPortFilterForm(DeviceComponentFilterForm):
|
||||
type = forms.MultipleChoiceField(
|
||||
choices=PortTypeChoices,
|
||||
required=False,
|
||||
widget=StaticSelect2Multiple()
|
||||
widget=StaticSelectMultiple()
|
||||
)
|
||||
color = ColorField(
|
||||
required=False
|
||||
@ -3660,7 +3660,7 @@ class RearPortForm(BootstrapMixin, CustomFieldModelForm):
|
||||
]
|
||||
widgets = {
|
||||
'device': forms.HiddenInput(),
|
||||
'type': StaticSelect2(),
|
||||
'type': StaticSelect(),
|
||||
}
|
||||
|
||||
|
||||
@ -3668,7 +3668,7 @@ class RearPortCreateForm(ComponentCreateForm):
|
||||
model = RearPort
|
||||
type = forms.ChoiceField(
|
||||
choices=PortTypeChoices,
|
||||
widget=StaticSelect2(),
|
||||
widget=StaticSelect(),
|
||||
)
|
||||
color = ColorField(
|
||||
required=False
|
||||
@ -3766,7 +3766,7 @@ class PopulateDeviceBayForm(BootstrapMixin, forms.Form):
|
||||
queryset=Device.objects.all(),
|
||||
label='Child Device',
|
||||
help_text="Child devices must first be created and assigned to the site/rack of the parent device.",
|
||||
widget=StaticSelect2(),
|
||||
widget=StaticSelect(),
|
||||
)
|
||||
|
||||
def __init__(self, device_bay, *args, **kwargs):
|
||||
@ -3981,7 +3981,7 @@ class InventoryItemFilterForm(DeviceComponentFilterForm):
|
||||
)
|
||||
discovered = forms.NullBooleanField(
|
||||
required=False,
|
||||
widget=StaticSelect2(
|
||||
widget=StaticSelect(
|
||||
choices=BOOLEAN_WITH_BLANK_CHOICES
|
||||
)
|
||||
)
|
||||
@ -4056,9 +4056,9 @@ class ConnectCableToDeviceForm(BootstrapMixin, CustomFieldModelForm):
|
||||
'termination_b_id', 'type', 'status', 'label', 'color', 'length', 'length_unit', 'tags',
|
||||
]
|
||||
widgets = {
|
||||
'status': StaticSelect2,
|
||||
'type': StaticSelect2,
|
||||
'length_unit': StaticSelect2,
|
||||
'status': StaticSelect,
|
||||
'type': StaticSelect,
|
||||
'length_unit': StaticSelect,
|
||||
}
|
||||
|
||||
def clean_termination_b_id(self):
|
||||
@ -4276,9 +4276,9 @@ class CableForm(BootstrapMixin, CustomFieldModelForm):
|
||||
'type', 'status', 'label', 'color', 'length', 'length_unit', 'tags',
|
||||
]
|
||||
widgets = {
|
||||
'status': StaticSelect2,
|
||||
'type': StaticSelect2,
|
||||
'length_unit': StaticSelect2,
|
||||
'status': StaticSelect,
|
||||
'type': StaticSelect,
|
||||
'length_unit': StaticSelect,
|
||||
}
|
||||
error_messages = {
|
||||
'length': {
|
||||
@ -4391,12 +4391,12 @@ class CableBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldModelBulkE
|
||||
choices=add_blank_choice(CableTypeChoices),
|
||||
required=False,
|
||||
initial='',
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
status = forms.ChoiceField(
|
||||
choices=add_blank_choice(CableStatusChoices),
|
||||
required=False,
|
||||
widget=StaticSelect2(),
|
||||
widget=StaticSelect(),
|
||||
initial=''
|
||||
)
|
||||
label = forms.CharField(
|
||||
@ -4414,7 +4414,7 @@ class CableBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldModelBulkE
|
||||
choices=add_blank_choice(CableLengthUnitChoices),
|
||||
required=False,
|
||||
initial='',
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@ -4472,12 +4472,12 @@ class CableFilterForm(BootstrapMixin, CustomFieldModelFilterForm):
|
||||
type = forms.MultipleChoiceField(
|
||||
choices=add_blank_choice(CableTypeChoices),
|
||||
required=False,
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
status = forms.ChoiceField(
|
||||
required=False,
|
||||
choices=add_blank_choice(CableStatusChoices),
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
color = ColorField(
|
||||
required=False
|
||||
@ -5045,10 +5045,10 @@ class PowerFeedForm(BootstrapMixin, CustomFieldModelForm):
|
||||
('Characteristics', ('supply', 'voltage', 'amperage', 'phase', 'max_utilization')),
|
||||
)
|
||||
widgets = {
|
||||
'status': StaticSelect2(),
|
||||
'type': StaticSelect2(),
|
||||
'supply': StaticSelect2(),
|
||||
'phase': StaticSelect2(),
|
||||
'status': StaticSelect(),
|
||||
'type': StaticSelect(),
|
||||
'supply': StaticSelect(),
|
||||
'phase': StaticSelect(),
|
||||
}
|
||||
|
||||
|
||||
@ -5141,25 +5141,25 @@ class PowerFeedBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldModelB
|
||||
choices=add_blank_choice(PowerFeedStatusChoices),
|
||||
required=False,
|
||||
initial='',
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
type = forms.ChoiceField(
|
||||
choices=add_blank_choice(PowerFeedTypeChoices),
|
||||
required=False,
|
||||
initial='',
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
supply = forms.ChoiceField(
|
||||
choices=add_blank_choice(PowerFeedSupplyChoices),
|
||||
required=False,
|
||||
initial='',
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
phase = forms.ChoiceField(
|
||||
choices=add_blank_choice(PowerFeedPhaseChoices),
|
||||
required=False,
|
||||
initial='',
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
voltage = forms.IntegerField(
|
||||
required=False
|
||||
@ -5233,22 +5233,22 @@ class PowerFeedFilterForm(BootstrapMixin, CustomFieldModelFilterForm):
|
||||
status = forms.MultipleChoiceField(
|
||||
choices=PowerFeedStatusChoices,
|
||||
required=False,
|
||||
widget=StaticSelect2Multiple()
|
||||
widget=StaticSelectMultiple()
|
||||
)
|
||||
type = forms.ChoiceField(
|
||||
choices=add_blank_choice(PowerFeedTypeChoices),
|
||||
required=False,
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
supply = forms.ChoiceField(
|
||||
choices=add_blank_choice(PowerFeedSupplyChoices),
|
||||
required=False,
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
phase = forms.ChoiceField(
|
||||
choices=add_blank_choice(PowerFeedPhaseChoices),
|
||||
required=False,
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
voltage = forms.IntegerField(
|
||||
required=False
|
||||
|
@ -9,8 +9,8 @@ from tenancy.models import Tenant, TenantGroup
|
||||
from utilities.forms import (
|
||||
add_blank_choice, APISelectMultiple, BootstrapMixin, BulkEditForm, BulkEditNullBooleanSelect, ColorField,
|
||||
CommentField, ContentTypeChoiceField, ContentTypeMultipleChoiceField, CSVContentTypeField, CSVModelForm,
|
||||
CSVMultipleContentTypeField, DateTimePicker, DynamicModelMultipleChoiceField, JSONField, SlugField, StaticSelect2,
|
||||
StaticSelect2Multiple, BOOLEAN_WITH_BLANK_CHOICES,
|
||||
CSVMultipleContentTypeField, DateTimePicker, DynamicModelMultipleChoiceField, JSONField, SlugField, StaticSelect,
|
||||
StaticSelectMultiple, BOOLEAN_WITH_BLANK_CHOICES,
|
||||
)
|
||||
from virtualization.models import Cluster, ClusterGroup
|
||||
from .choices import *
|
||||
@ -87,14 +87,14 @@ class CustomFieldFilterForm(BootstrapMixin, forms.Form):
|
||||
type = forms.MultipleChoiceField(
|
||||
choices=CustomFieldTypeChoices,
|
||||
required=False,
|
||||
widget=StaticSelect2Multiple()
|
||||
widget=StaticSelectMultiple()
|
||||
)
|
||||
weight = forms.IntegerField(
|
||||
required=False
|
||||
)
|
||||
required = forms.NullBooleanField(
|
||||
required=False,
|
||||
widget=StaticSelect2(
|
||||
widget=StaticSelect(
|
||||
choices=BOOLEAN_WITH_BLANK_CHOICES
|
||||
)
|
||||
)
|
||||
@ -153,7 +153,7 @@ class CustomLinkBulkEditForm(BootstrapMixin, BulkEditForm):
|
||||
button_class = forms.ChoiceField(
|
||||
choices=CustomLinkButtonClassChoices,
|
||||
required=False,
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@ -174,7 +174,7 @@ class CustomLinkFilterForm(BootstrapMixin, forms.Form):
|
||||
)
|
||||
new_window = forms.NullBooleanField(
|
||||
required=False,
|
||||
widget=StaticSelect2(
|
||||
widget=StaticSelect(
|
||||
choices=BOOLEAN_WITH_BLANK_CHOICES
|
||||
)
|
||||
)
|
||||
@ -262,7 +262,7 @@ class ExportTemplateFilterForm(BootstrapMixin, forms.Form):
|
||||
)
|
||||
as_attachment = forms.NullBooleanField(
|
||||
required=False,
|
||||
widget=StaticSelect2(
|
||||
widget=StaticSelect(
|
||||
choices=BOOLEAN_WITH_BLANK_CHOICES
|
||||
)
|
||||
)
|
||||
@ -363,29 +363,29 @@ class WebhookFilterForm(BootstrapMixin, forms.Form):
|
||||
http_method = forms.MultipleChoiceField(
|
||||
choices=WebhookHttpMethodChoices,
|
||||
required=False,
|
||||
widget=StaticSelect2Multiple()
|
||||
widget=StaticSelectMultiple()
|
||||
)
|
||||
enabled = forms.NullBooleanField(
|
||||
required=False,
|
||||
widget=StaticSelect2(
|
||||
widget=StaticSelect(
|
||||
choices=BOOLEAN_WITH_BLANK_CHOICES
|
||||
)
|
||||
)
|
||||
type_create = forms.NullBooleanField(
|
||||
required=False,
|
||||
widget=StaticSelect2(
|
||||
widget=StaticSelect(
|
||||
choices=BOOLEAN_WITH_BLANK_CHOICES
|
||||
)
|
||||
)
|
||||
type_update = forms.NullBooleanField(
|
||||
required=False,
|
||||
widget=StaticSelect2(
|
||||
widget=StaticSelect(
|
||||
choices=BOOLEAN_WITH_BLANK_CHOICES
|
||||
)
|
||||
)
|
||||
type_delete = forms.NullBooleanField(
|
||||
required=False,
|
||||
widget=StaticSelect2(
|
||||
widget=StaticSelect(
|
||||
choices=BOOLEAN_WITH_BLANK_CHOICES
|
||||
)
|
||||
)
|
||||
@ -734,7 +734,7 @@ class LocalConfigContextFilterForm(forms.Form):
|
||||
local_context_data = forms.NullBooleanField(
|
||||
required=False,
|
||||
label=_('Has local config context data'),
|
||||
widget=StaticSelect2(
|
||||
widget=StaticSelect(
|
||||
choices=BOOLEAN_WITH_BLANK_CHOICES
|
||||
)
|
||||
)
|
||||
@ -763,7 +763,7 @@ class JournalEntryForm(BootstrapMixin, forms.ModelForm):
|
||||
kind = forms.ChoiceField(
|
||||
choices=add_blank_choice(JournalEntryKindChoices),
|
||||
required=False,
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
|
||||
class Meta:
|
||||
@ -828,7 +828,7 @@ class JournalEntryFilterForm(BootstrapMixin, forms.Form):
|
||||
kind = forms.ChoiceField(
|
||||
choices=add_blank_choice(JournalEntryKindChoices),
|
||||
required=False,
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
|
||||
|
||||
@ -855,7 +855,7 @@ class ObjectChangeFilterForm(BootstrapMixin, forms.Form):
|
||||
action = forms.ChoiceField(
|
||||
choices=add_blank_choice(ObjectChangeActionChoices),
|
||||
required=False,
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
user_id = DynamicModelMultipleChoiceField(
|
||||
queryset=User.objects.all(),
|
||||
|
@ -13,7 +13,7 @@ from extras.choices import *
|
||||
from extras.utils import FeatureQuery, extras_features
|
||||
from netbox.models import ChangeLoggedModel
|
||||
from utilities.forms import (
|
||||
CSVChoiceField, DatePicker, LaxURLField, StaticSelect2Multiple, StaticSelect2, add_blank_choice,
|
||||
CSVChoiceField, DatePicker, LaxURLField, StaticSelectMultiple, StaticSelect, add_blank_choice,
|
||||
)
|
||||
from utilities.querysets import RestrictedQuerySet
|
||||
from utilities.validators import validate_regex
|
||||
@ -226,7 +226,7 @@ class CustomField(ChangeLoggedModel):
|
||||
(False, 'False'),
|
||||
)
|
||||
field = forms.NullBooleanField(
|
||||
required=required, initial=initial, widget=StaticSelect2(choices=choices)
|
||||
required=required, initial=initial, widget=StaticSelect(choices=choices)
|
||||
)
|
||||
|
||||
# Date
|
||||
@ -248,12 +248,12 @@ class CustomField(ChangeLoggedModel):
|
||||
if self.type == CustomFieldTypeChoices.TYPE_SELECT:
|
||||
field_class = CSVChoiceField if for_csv_import else forms.ChoiceField
|
||||
field = field_class(
|
||||
choices=choices, required=required, initial=initial, widget=StaticSelect2()
|
||||
choices=choices, required=required, initial=initial, widget=StaticSelect()
|
||||
)
|
||||
else:
|
||||
field_class = CSVChoiceField if for_csv_import else forms.MultipleChoiceField
|
||||
field = field_class(
|
||||
choices=choices, required=required, initial=initial, widget=StaticSelect2Multiple()
|
||||
choices=choices, required=required, initial=initial, widget=StaticSelectMultiple()
|
||||
)
|
||||
|
||||
# URL
|
||||
|
@ -12,7 +12,7 @@ from tenancy.models import Tenant
|
||||
from utilities.forms import (
|
||||
add_blank_choice, BootstrapMixin, BulkEditNullBooleanSelect, ContentTypeChoiceField, CSVChoiceField,
|
||||
CSVModelChoiceField, DatePicker, DynamicModelChoiceField, DynamicModelMultipleChoiceField, ExpandableIPAddressField,
|
||||
NumericArrayField, ReturnURLForm, SlugField, StaticSelect2, StaticSelect2Multiple, TagFilterField,
|
||||
NumericArrayField, ReturnURLForm, SlugField, StaticSelect, StaticSelectMultiple, TagFilterField,
|
||||
BOOLEAN_WITH_BLANK_CHOICES,
|
||||
)
|
||||
from virtualization.models import Cluster, ClusterGroup, VirtualMachine, VMInterface
|
||||
@ -242,7 +242,7 @@ class RIRFilterForm(BootstrapMixin, forms.Form):
|
||||
is_private = forms.NullBooleanField(
|
||||
required=False,
|
||||
label=_('Private'),
|
||||
widget=StaticSelect2(
|
||||
widget=StaticSelect(
|
||||
choices=BOOLEAN_WITH_BLANK_CHOICES
|
||||
)
|
||||
)
|
||||
@ -340,7 +340,7 @@ class AggregateFilterForm(BootstrapMixin, TenancyFilterForm, CustomFieldModelFil
|
||||
required=False,
|
||||
choices=add_blank_choice(IPAddressFamilyChoices),
|
||||
label=_('Address family'),
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
rir_id = DynamicModelMultipleChoiceField(
|
||||
queryset=RIR.objects.all(),
|
||||
@ -464,7 +464,7 @@ class PrefixForm(BootstrapMixin, TenancyForm, CustomFieldModelForm):
|
||||
('Tenancy', ('tenant_group', 'tenant')),
|
||||
)
|
||||
widgets = {
|
||||
'status': StaticSelect2(),
|
||||
'status': StaticSelect(),
|
||||
}
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
@ -575,7 +575,7 @@ class PrefixBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldModelBulk
|
||||
status = forms.ChoiceField(
|
||||
choices=add_blank_choice(PrefixStatusChoices),
|
||||
required=False,
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
role = DynamicModelChoiceField(
|
||||
queryset=Role.objects.all(),
|
||||
@ -630,13 +630,13 @@ class PrefixFilterForm(BootstrapMixin, TenancyFilterForm, CustomFieldModelFilter
|
||||
required=False,
|
||||
choices=add_blank_choice(IPAddressFamilyChoices),
|
||||
label=_('Address family'),
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
mask_length = forms.ChoiceField(
|
||||
required=False,
|
||||
choices=PREFIX_MASK_LENGTH_CHOICES,
|
||||
label=_('Mask length'),
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
vrf_id = DynamicModelMultipleChoiceField(
|
||||
queryset=VRF.objects.all(),
|
||||
@ -652,7 +652,7 @@ class PrefixFilterForm(BootstrapMixin, TenancyFilterForm, CustomFieldModelFilter
|
||||
status = forms.MultipleChoiceField(
|
||||
choices=PrefixStatusChoices,
|
||||
required=False,
|
||||
widget=StaticSelect2Multiple()
|
||||
widget=StaticSelectMultiple()
|
||||
)
|
||||
region_id = DynamicModelMultipleChoiceField(
|
||||
queryset=Region.objects.all(),
|
||||
@ -682,14 +682,14 @@ class PrefixFilterForm(BootstrapMixin, TenancyFilterForm, CustomFieldModelFilter
|
||||
is_pool = forms.NullBooleanField(
|
||||
required=False,
|
||||
label=_('Is a pool'),
|
||||
widget=StaticSelect2(
|
||||
widget=StaticSelect(
|
||||
choices=BOOLEAN_WITH_BLANK_CHOICES
|
||||
)
|
||||
)
|
||||
mark_utilized = forms.NullBooleanField(
|
||||
required=False,
|
||||
label=_('Marked as 100% utilized'),
|
||||
widget=StaticSelect2(
|
||||
widget=StaticSelect(
|
||||
choices=BOOLEAN_WITH_BLANK_CHOICES
|
||||
)
|
||||
)
|
||||
@ -961,8 +961,8 @@ class IPAddressForm(BootstrapMixin, TenancyForm, ReturnURLForm, CustomFieldModel
|
||||
'tags',
|
||||
]
|
||||
widgets = {
|
||||
'status': StaticSelect2(),
|
||||
'role': StaticSelect2(),
|
||||
'status': StaticSelect(),
|
||||
'role': StaticSelect(),
|
||||
}
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
@ -1061,8 +1061,8 @@ class IPAddressBulkAddForm(BootstrapMixin, TenancyForm, CustomFieldModelForm):
|
||||
'address', 'vrf', 'status', 'role', 'dns_name', 'description', 'tenant_group', 'tenant', 'tags',
|
||||
]
|
||||
widgets = {
|
||||
'status': StaticSelect2(),
|
||||
'role': StaticSelect2(),
|
||||
'status': StaticSelect(),
|
||||
'role': StaticSelect(),
|
||||
}
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
@ -1193,12 +1193,12 @@ class IPAddressBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldModelB
|
||||
status = forms.ChoiceField(
|
||||
choices=add_blank_choice(IPAddressStatusChoices),
|
||||
required=False,
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
role = forms.ChoiceField(
|
||||
choices=add_blank_choice(IPAddressRoleChoices),
|
||||
required=False,
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
dns_name = forms.CharField(
|
||||
max_length=255,
|
||||
@ -1253,13 +1253,13 @@ class IPAddressFilterForm(BootstrapMixin, TenancyFilterForm, CustomFieldModelFil
|
||||
required=False,
|
||||
choices=add_blank_choice(IPAddressFamilyChoices),
|
||||
label=_('Address family'),
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
mask_length = forms.ChoiceField(
|
||||
required=False,
|
||||
choices=IPADDRESS_MASK_LENGTH_CHOICES,
|
||||
label=_('Mask length'),
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
vrf_id = DynamicModelMultipleChoiceField(
|
||||
queryset=VRF.objects.all(),
|
||||
@ -1275,17 +1275,17 @@ class IPAddressFilterForm(BootstrapMixin, TenancyFilterForm, CustomFieldModelFil
|
||||
status = forms.MultipleChoiceField(
|
||||
choices=IPAddressStatusChoices,
|
||||
required=False,
|
||||
widget=StaticSelect2Multiple()
|
||||
widget=StaticSelectMultiple()
|
||||
)
|
||||
role = forms.MultipleChoiceField(
|
||||
choices=IPAddressRoleChoices,
|
||||
required=False,
|
||||
widget=StaticSelect2Multiple()
|
||||
widget=StaticSelectMultiple()
|
||||
)
|
||||
assigned_to_interface = forms.NullBooleanField(
|
||||
required=False,
|
||||
label=_('Assigned to an interface'),
|
||||
widget=StaticSelect2(
|
||||
widget=StaticSelect(
|
||||
choices=BOOLEAN_WITH_BLANK_CHOICES
|
||||
)
|
||||
)
|
||||
@ -1300,7 +1300,7 @@ class VLANGroupForm(BootstrapMixin, CustomFieldModelForm):
|
||||
scope_type = ContentTypeChoiceField(
|
||||
queryset=ContentType.objects.filter(model__in=VLANGROUP_SCOPE_TYPES),
|
||||
required=False,
|
||||
widget=StaticSelect2
|
||||
widget=StaticSelect
|
||||
)
|
||||
region = DynamicModelChoiceField(
|
||||
queryset=Region.objects.all(),
|
||||
@ -1370,7 +1370,7 @@ class VLANGroupForm(BootstrapMixin, CustomFieldModelForm):
|
||||
'clustergroup', 'cluster',
|
||||
]
|
||||
widgets = {
|
||||
'scope_type': StaticSelect2,
|
||||
'scope_type': StaticSelect,
|
||||
}
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
@ -1481,7 +1481,7 @@ class VLANForm(BootstrapMixin, TenancyForm, CustomFieldModelForm):
|
||||
('virtualization.cluster', 'Cluster'),
|
||||
),
|
||||
required=False,
|
||||
widget=StaticSelect2,
|
||||
widget=StaticSelect,
|
||||
label='Group scope'
|
||||
)
|
||||
group = DynamicModelChoiceField(
|
||||
@ -1544,7 +1544,7 @@ class VLANForm(BootstrapMixin, TenancyForm, CustomFieldModelForm):
|
||||
'role': "The primary function of this VLAN",
|
||||
}
|
||||
widgets = {
|
||||
'status': StaticSelect2(),
|
||||
'status': StaticSelect(),
|
||||
}
|
||||
|
||||
|
||||
@ -1622,7 +1622,7 @@ class VLANBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldModelBulkEd
|
||||
status = forms.ChoiceField(
|
||||
choices=add_blank_choice(VLANStatusChoices),
|
||||
required=False,
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
role = DynamicModelChoiceField(
|
||||
queryset=Role.objects.all(),
|
||||
@ -1680,7 +1680,7 @@ class VLANFilterForm(BootstrapMixin, TenancyFilterForm, CustomFieldModelFilterFo
|
||||
status = forms.MultipleChoiceField(
|
||||
choices=VLANStatusChoices,
|
||||
required=False,
|
||||
widget=StaticSelect2Multiple()
|
||||
widget=StaticSelectMultiple()
|
||||
)
|
||||
role_id = DynamicModelMultipleChoiceField(
|
||||
queryset=Role.objects.all(),
|
||||
@ -1718,8 +1718,8 @@ class ServiceForm(BootstrapMixin, CustomFieldModelForm):
|
||||
"reachable via all IPs assigned to the device.",
|
||||
}
|
||||
widgets = {
|
||||
'protocol': StaticSelect2(),
|
||||
'ipaddresses': StaticSelect2Multiple(),
|
||||
'protocol': StaticSelect(),
|
||||
'ipaddresses': StaticSelectMultiple(),
|
||||
}
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
@ -1743,7 +1743,7 @@ class ServiceFilterForm(BootstrapMixin, CustomFieldModelFilterForm):
|
||||
protocol = forms.ChoiceField(
|
||||
choices=add_blank_choice(ServiceProtocolChoices),
|
||||
required=False,
|
||||
widget=StaticSelect2Multiple()
|
||||
widget=StaticSelectMultiple()
|
||||
)
|
||||
port = forms.IntegerField(
|
||||
required=False,
|
||||
@ -1782,7 +1782,7 @@ class ServiceBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldModelBul
|
||||
protocol = forms.ChoiceField(
|
||||
choices=add_blank_choice(ServiceProtocolChoices),
|
||||
required=False,
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
ports = NumericArrayField(
|
||||
base_field=forms.IntegerField(
|
||||
|
BIN
netbox/project-static/dist/netbox.js
vendored
BIN
netbox/project-static/dist/netbox.js
vendored
Binary file not shown.
BIN
netbox/project-static/dist/netbox.js.map
vendored
BIN
netbox/project-static/dist/netbox.js.map
vendored
Binary file not shown.
@ -185,7 +185,7 @@ function getDisplayName(result: APIObjectBase, select: HTMLSelectElement): strin
|
||||
* Initialize select elements that rely on the NetBox API to build their options.
|
||||
*/
|
||||
export function initApiSelect() {
|
||||
for (const select of getElements<HTMLSelectElement>('.netbox-select2-api')) {
|
||||
for (const select of getElements<HTMLSelectElement>('.netbox-api-select')) {
|
||||
const dependencies = getDependencyIds(select);
|
||||
// Initialize an event, so other elements relying on this element can subscribe to this
|
||||
// element's value.
|
||||
|
@ -16,7 +16,7 @@ function canChangeColor(option: Option | HTMLOptionElement): boolean {
|
||||
* the selected option.
|
||||
*/
|
||||
export function initColorSelect(): void {
|
||||
for (const select of getElements<HTMLSelectElement>('select.netbox-select2-color-picker')) {
|
||||
for (const select of getElements<HTMLSelectElement>('select.netbox-color-select')) {
|
||||
for (const option of select.options) {
|
||||
if (canChangeColor(option)) {
|
||||
// Get the background color from the option's value.
|
||||
|
@ -2,7 +2,7 @@ import SlimSelect from 'slim-select';
|
||||
import { getElements } from '../util';
|
||||
|
||||
export function initStaticSelect() {
|
||||
for (const select of getElements<HTMLSelectElement>('.netbox-select2-static')) {
|
||||
for (const select of getElements<HTMLSelectElement>('.netbox-select-static')) {
|
||||
if (select !== null) {
|
||||
const label = document.querySelector(`label[for=${select.id}]`) as HTMLLabelElement;
|
||||
|
||||
|
@ -85,7 +85,7 @@ class TagFilterField(forms.MultipleChoiceField):
|
||||
|
||||
:param model: The model of the filter
|
||||
"""
|
||||
widget = widgets.StaticSelect2Multiple
|
||||
widget = widgets.StaticSelectMultiple
|
||||
|
||||
def __init__(self, model, *args, **kwargs):
|
||||
def get_choices():
|
||||
|
@ -4,7 +4,7 @@ import re
|
||||
import yaml
|
||||
from django import forms
|
||||
|
||||
from .widgets import APISelect, APISelectMultiple, StaticSelect2
|
||||
from .widgets import APISelect, APISelectMultiple, StaticSelect
|
||||
|
||||
|
||||
__all__ = (
|
||||
@ -35,7 +35,7 @@ class BootstrapMixin(forms.BaseForm):
|
||||
forms.Select,
|
||||
APISelect,
|
||||
APISelectMultiple,
|
||||
StaticSelect2,
|
||||
StaticSelect,
|
||||
]
|
||||
|
||||
for field_name, field in self.fields.items():
|
||||
|
@ -21,8 +21,8 @@ __all__ = (
|
||||
'SelectWithPK',
|
||||
'SlugWidget',
|
||||
'SmallTextarea',
|
||||
'StaticSelect2',
|
||||
'StaticSelect2Multiple',
|
||||
'StaticSelect',
|
||||
'StaticSelectMultiple',
|
||||
'TimePicker',
|
||||
)
|
||||
|
||||
@ -50,7 +50,7 @@ class ColorSelect(forms.Select):
|
||||
def __init__(self, *args, **kwargs):
|
||||
kwargs['choices'] = add_blank_choice(ColorChoices)
|
||||
super().__init__(*args, **kwargs)
|
||||
self.attrs['class'] = 'netbox-select2-color-picker'
|
||||
self.attrs['class'] = 'netbox-color-select'
|
||||
|
||||
|
||||
class BulkEditNullBooleanSelect(forms.NullBooleanSelect):
|
||||
@ -67,7 +67,7 @@ class BulkEditNullBooleanSelect(forms.NullBooleanSelect):
|
||||
('2', 'Yes'),
|
||||
('3', 'No'),
|
||||
)
|
||||
self.attrs['class'] = 'netbox-select2-static'
|
||||
self.attrs['class'] = 'netbox-static-select'
|
||||
|
||||
|
||||
class SelectWithDisabled(forms.Select):
|
||||
@ -78,17 +78,17 @@ class SelectWithDisabled(forms.Select):
|
||||
option_template_name = 'widgets/selectwithdisabled_option.html'
|
||||
|
||||
|
||||
class StaticSelect2(SelectWithDisabled):
|
||||
class StaticSelect(SelectWithDisabled):
|
||||
"""
|
||||
A static <select> form widget using the Select2 library.
|
||||
A static <select/> form widget which is client-side rendered.
|
||||
"""
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
self.attrs['class'] = 'netbox-select2-static'
|
||||
self.attrs['class'] = 'netbox-static-select'
|
||||
|
||||
|
||||
class StaticSelect2Multiple(StaticSelect2, forms.SelectMultiple):
|
||||
class StaticSelectMultiple(StaticSelect, forms.SelectMultiple):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
@ -96,14 +96,14 @@ class StaticSelect2Multiple(StaticSelect2, forms.SelectMultiple):
|
||||
self.attrs['data-multiple'] = 1
|
||||
|
||||
|
||||
class SelectWithPK(StaticSelect2):
|
||||
class SelectWithPK(StaticSelect):
|
||||
"""
|
||||
Include the primary key of each option in the option label (e.g. "Router7 (4721)").
|
||||
"""
|
||||
option_template_name = 'widgets/select_option_with_pk.html'
|
||||
|
||||
|
||||
class ContentTypeSelect(StaticSelect2):
|
||||
class ContentTypeSelect(StaticSelect):
|
||||
"""
|
||||
Appends an `api-value` attribute equal to the slugified model name for each ContentType. For example:
|
||||
<option value="37" api-value="console-server-port">console server port</option>
|
||||
@ -138,7 +138,7 @@ class APISelect(SelectWithDisabled):
|
||||
def __init__(self, api_url=None, full=False, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
self.attrs['class'] = 'netbox-select2-api'
|
||||
self.attrs['class'] = 'netbox-api-select'
|
||||
if api_url:
|
||||
self.attrs['data-url'] = '/{}{}'.format(settings.BASE_PATH, api_url.lstrip('/')) # Inject BASE_PATH
|
||||
|
||||
|
@ -18,7 +18,7 @@ from tenancy.models import Tenant
|
||||
from utilities.forms import (
|
||||
add_blank_choice, BootstrapMixin, BulkEditNullBooleanSelect, BulkRenameForm, CommentField, ConfirmationForm,
|
||||
CSVChoiceField, CSVModelChoiceField, DynamicModelChoiceField, DynamicModelMultipleChoiceField, ExpandableNameField,
|
||||
form_from_model, JSONField, SlugField, SmallTextarea, StaticSelect2, StaticSelect2Multiple, TagFilterField,
|
||||
form_from_model, JSONField, SlugField, SmallTextarea, StaticSelect, StaticSelectMultiple, TagFilterField,
|
||||
BOOLEAN_WITH_BLANK_CHOICES,
|
||||
)
|
||||
from .choices import *
|
||||
@ -389,9 +389,9 @@ class VirtualMachineForm(BootstrapMixin, TenancyForm, CustomFieldModelForm):
|
||||
"config context",
|
||||
}
|
||||
widgets = {
|
||||
"status": StaticSelect2(),
|
||||
'primary_ip4': StaticSelect2(),
|
||||
'primary_ip6': StaticSelect2(),
|
||||
"status": StaticSelect(),
|
||||
'primary_ip4': StaticSelect(),
|
||||
'primary_ip6': StaticSelect(),
|
||||
}
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
@ -483,7 +483,7 @@ class VirtualMachineBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldM
|
||||
choices=add_blank_choice(VirtualMachineStatusChoices),
|
||||
required=False,
|
||||
initial='',
|
||||
widget=StaticSelect2(),
|
||||
widget=StaticSelect(),
|
||||
)
|
||||
cluster = DynamicModelChoiceField(
|
||||
queryset=Cluster.objects.all(),
|
||||
@ -592,7 +592,7 @@ class VirtualMachineFilterForm(BootstrapMixin, TenancyFilterForm, CustomFieldMod
|
||||
status = forms.MultipleChoiceField(
|
||||
choices=VirtualMachineStatusChoices,
|
||||
required=False,
|
||||
widget=StaticSelect2Multiple()
|
||||
widget=StaticSelectMultiple()
|
||||
)
|
||||
platform_id = DynamicModelMultipleChoiceField(
|
||||
queryset=Platform.objects.all(),
|
||||
@ -607,7 +607,7 @@ class VirtualMachineFilterForm(BootstrapMixin, TenancyFilterForm, CustomFieldMod
|
||||
has_primary_ip = forms.NullBooleanField(
|
||||
required=False,
|
||||
label='Has a primary IP',
|
||||
widget=StaticSelect2(
|
||||
widget=StaticSelect(
|
||||
choices=BOOLEAN_WITH_BLANK_CHOICES
|
||||
)
|
||||
)
|
||||
@ -647,7 +647,7 @@ class VMInterfaceForm(BootstrapMixin, InterfaceCommonForm, CustomFieldModelForm)
|
||||
]
|
||||
widgets = {
|
||||
'virtual_machine': forms.HiddenInput(),
|
||||
'mode': StaticSelect2()
|
||||
'mode': StaticSelect()
|
||||
}
|
||||
labels = {
|
||||
'mode': '802.1Q Mode',
|
||||
@ -704,7 +704,7 @@ class VMInterfaceCreateForm(BootstrapMixin, CustomFieldsMixin, InterfaceCommonFo
|
||||
mode = forms.ChoiceField(
|
||||
choices=add_blank_choice(InterfaceModeChoices),
|
||||
required=False,
|
||||
widget=StaticSelect2(),
|
||||
widget=StaticSelect(),
|
||||
)
|
||||
untagged_vlan = DynamicModelChoiceField(
|
||||
queryset=VLAN.objects.all(),
|
||||
@ -789,7 +789,7 @@ class VMInterfaceBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldMode
|
||||
mode = forms.ChoiceField(
|
||||
choices=add_blank_choice(InterfaceModeChoices),
|
||||
required=False,
|
||||
widget=StaticSelect2()
|
||||
widget=StaticSelect()
|
||||
)
|
||||
untagged_vlan = DynamicModelChoiceField(
|
||||
queryset=VLAN.objects.all(),
|
||||
@ -868,7 +868,7 @@ class VMInterfaceFilterForm(BootstrapMixin, forms.Form):
|
||||
)
|
||||
enabled = forms.NullBooleanField(
|
||||
required=False,
|
||||
widget=StaticSelect2(
|
||||
widget=StaticSelect(
|
||||
choices=BOOLEAN_WITH_BLANK_CHOICES
|
||||
)
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user