From 045d2364795638ba6c9ceac0cbde261b2af55cad Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Thu, 16 Feb 2023 09:16:38 -0500 Subject: [PATCH] Tag custom ChoiceField, MultipleChoiceField classes for removal in v3.6 --- docs/plugins/development/forms.md | 3 +++ netbox/dcim/forms/model_forms.py | 5 +---- netbox/utilities/forms/fields/fields.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/plugins/development/forms.md b/docs/plugins/development/forms.md index d819b76cb..db7adff23 100644 --- a/docs/plugins/development/forms.md +++ b/docs/plugins/development/forms.md @@ -170,6 +170,9 @@ In addition to the [form fields provided by Django](https://docs.djangoproject.c ## Choice Fields +!!! warning "Obsolete Fields" + NetBox's custom `ChoiceField` and `MultipleChoiceField` classes are no longer necessary thanks to improvements made to the user interface. Django's native form fields can be used instead. These custom field classes will be removed in NetBox v3.6. + ::: utilities.forms.ChoiceField options: members: false diff --git a/netbox/dcim/forms/model_forms.py b/netbox/dcim/forms/model_forms.py index d5bd235c6..8bac5d342 100644 --- a/netbox/dcim/forms/model_forms.py +++ b/netbox/dcim/forms/model_forms.py @@ -129,8 +129,7 @@ class SiteForm(TenancyForm, NetBoxModelForm): slug = SlugField() time_zone = TimeZoneFormField( choices=add_blank_choice(TimeZoneFormField().choices), - required=False, - # widget=StaticSelect() + required=False ) comments = CommentField() @@ -159,8 +158,6 @@ class SiteForm(TenancyForm, NetBoxModelForm): 'rows': 3, } ), - # 'status': StaticSelect(), - # 'time_zone': StaticSelect(), } help_texts = { 'name': _("Full name of the site"), diff --git a/netbox/utilities/forms/fields/fields.py b/netbox/utilities/forms/fields/fields.py index 573315c35..c5d2d0a1f 100644 --- a/netbox/utilities/forms/fields/fields.py +++ b/netbox/utilities/forms/fields/fields.py @@ -138,7 +138,7 @@ class ChoiceField(forms.ChoiceField): """ Previously used to override Django's built-in `ChoiceField` to use NetBox's now-obsolete `StaticSelect` widget. """ - # TODO: Remove in v4.0 + # TODO: Remove in v3.6 pass @@ -147,5 +147,5 @@ class MultipleChoiceField(forms.MultipleChoiceField): Previously used to override Django's built-in `MultipleChoiceField` to use NetBox's now-obsolete `StaticSelectMultiple` widget. """ - # TODO: Remove in v4.0 + # TODO: Remove in v3.6 pass