Closes #11765: Remove StaticSelect & StaticSelectMultiple (#11767)

* Remove StaticSelect, StaticSelectMultiple form widgets

* Tag custom ChoiceField, MultipleChoiceField classes for removal in v3.6
This commit is contained in:
Jeremy Stretch
2023-02-16 10:25:51 -05:00
committed by jeremystretch
parent f675e10240
commit 0e40cb0a1b
30 changed files with 221 additions and 485 deletions

View File

@@ -4,7 +4,7 @@ from django.utils.translation import gettext as _
from dcim.choices import LinkStatusChoices
from netbox.forms import NetBoxModelFilterSetForm
from tenancy.forms import TenancyFilterForm
from utilities.forms import add_blank_choice, DynamicModelMultipleChoiceField, StaticSelect, TagFilterField
from utilities.forms import add_blank_choice, DynamicModelMultipleChoiceField, TagFilterField
from wireless.choices import *
from wireless.models import *
@@ -45,18 +45,15 @@ class WirelessLANFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
)
status = forms.ChoiceField(
required=False,
choices=add_blank_choice(WirelessLANStatusChoices),
widget=StaticSelect()
choices=add_blank_choice(WirelessLANStatusChoices)
)
auth_type = forms.ChoiceField(
required=False,
choices=add_blank_choice(WirelessAuthTypeChoices),
widget=StaticSelect()
choices=add_blank_choice(WirelessAuthTypeChoices)
)
auth_cipher = forms.ChoiceField(
required=False,
choices=add_blank_choice(WirelessAuthCipherChoices),
widget=StaticSelect()
choices=add_blank_choice(WirelessAuthCipherChoices)
)
auth_psk = forms.CharField(
required=False
@@ -78,18 +75,15 @@ class WirelessLinkFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
)
status = forms.ChoiceField(
required=False,
choices=add_blank_choice(LinkStatusChoices),
widget=StaticSelect()
choices=add_blank_choice(LinkStatusChoices)
)
auth_type = forms.ChoiceField(
required=False,
choices=add_blank_choice(WirelessAuthTypeChoices),
widget=StaticSelect()
choices=add_blank_choice(WirelessAuthTypeChoices)
)
auth_cipher = forms.ChoiceField(
required=False,
choices=add_blank_choice(WirelessAuthCipherChoices),
widget=StaticSelect()
choices=add_blank_choice(WirelessAuthCipherChoices)
)
auth_psk = forms.CharField(
required=False

View File

@@ -3,7 +3,7 @@ from dcim.models import Device, Interface, Location, Region, Site, SiteGroup
from ipam.models import VLAN, VLANGroup
from netbox.forms import NetBoxModelForm
from tenancy.forms import TenancyForm
from utilities.forms import CommentField, DynamicModelChoiceField, SlugField, StaticSelect
from utilities.forms import CommentField, DynamicModelChoiceField, SlugField
from wireless.models import *
__all__ = (
@@ -97,11 +97,6 @@ class WirelessLANForm(TenancyForm, NetBoxModelForm):
'ssid', 'group', 'region', 'site_group', 'site', 'status', 'vlan_group', 'vlan', 'tenant_group', 'tenant',
'auth_type', 'auth_cipher', 'auth_psk', 'description', 'comments', 'tags',
]
widgets = {
'status': StaticSelect,
'auth_type': StaticSelect,
'auth_cipher': StaticSelect,
}
class WirelessLinkForm(TenancyForm, NetBoxModelForm):
@@ -202,11 +197,6 @@ class WirelessLinkForm(TenancyForm, NetBoxModelForm):
'status', 'ssid', 'tenant_group', 'tenant', 'auth_type', 'auth_cipher', 'auth_psk', 'description',
'comments', 'tags',
]
widgets = {
'status': StaticSelect,
'auth_type': StaticSelect,
'auth_cipher': StaticSelect,
}
labels = {
'auth_type': 'Type',
'auth_cipher': 'Cipher',