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

@@ -27,11 +27,11 @@ class ContentTypeChoiceField(ContentTypeChoiceMixin, forms.ModelChoiceField):
"""
Selection field for a single content type.
"""
widget = widgets.StaticSelect
pass
class ContentTypeMultipleChoiceField(ContentTypeChoiceMixin, forms.ModelMultipleChoiceField):
"""
Selection field for one or more content types.
"""
widget = widgets.StaticSelectMultiple
pass

View File

@@ -68,7 +68,6 @@ class TagFilterField(forms.MultipleChoiceField):
:param model: The model of the filter
"""
widget = widgets.StaticSelectMultiple
def __init__(self, model, *args, **kwargs):
def get_choices():
@@ -137,13 +136,16 @@ class MACAddressField(forms.Field):
class ChoiceField(forms.ChoiceField):
"""
Overrides Django's built-in `ChoiceField` to use NetBox's `StaticSelect` widget
Previously used to override Django's built-in `ChoiceField` to use NetBox's now-obsolete `StaticSelect` widget.
"""
widget = widgets.StaticSelect
# TODO: Remove in v3.6
pass
class MultipleChoiceField(forms.MultipleChoiceField):
"""
Overrides Django's built-in `MultipleChoiceField` to use NetBox's `StaticSelectMultiple` widget
Previously used to override Django's built-in `MultipleChoiceField` to use NetBox's now-obsolete
`StaticSelectMultiple` widget.
"""
widget = widgets.StaticSelectMultiple
# TODO: Remove in v3.6
pass