summaryrefslogtreecommitdiff
path: root/django/forms
diff options
context:
space:
mode:
authorDavid <smithdc@gmail.com>2022-01-13 23:08:38 +0000
committerCarlton Gibson <carlton@noumenal.es>2022-03-30 16:28:14 +0200
commitc8459708a7e0a2474255b77d0f104a7f16e8b32c (patch)
treeadd60b1d21cfaa37e51c116348054e71c91f73a1 /django/forms
parent04ad0f26ba4b8c79dc311e1789457e0c4d1b8832 (diff)
Refs #32339 -- Added use_fieldset to Widget.
Diffstat (limited to 'django/forms')
-rw-r--r--django/forms/boundfield.py7
-rw-r--r--django/forms/widgets.py4
2 files changed, 11 insertions, 0 deletions
diff --git a/django/forms/boundfield.py b/django/forms/boundfield.py
index e83160645e..9f2ae59ab4 100644
--- a/django/forms/boundfield.py
+++ b/django/forms/boundfield.py
@@ -286,6 +286,13 @@ class BoundField:
r"widget$|input$", "", self.field.widget.__class__.__name__.lower()
)
+ @property
+ def use_fieldset(self):
+ """
+ Return the value of this BoundField widget's use_fieldset attribute.
+ """
+ return self.field.widget.use_fieldset
+
@html_safe
class BoundWidget:
diff --git a/django/forms/widgets.py b/django/forms/widgets.py
index 208464b60a..760579ebe5 100644
--- a/django/forms/widgets.py
+++ b/django/forms/widgets.py
@@ -234,6 +234,7 @@ class Widget(metaclass=MediaDefiningClass):
is_localized = False
is_required = False
supports_microseconds = True
+ use_fieldset = False
def __init__(self, attrs=None):
self.attrs = {} if attrs is None else attrs.copy()
@@ -821,6 +822,7 @@ class RadioSelect(ChoiceWidget):
input_type = "radio"
template_name = "django/forms/widgets/radio.html"
option_template_name = "django/forms/widgets/radio_option.html"
+ use_fieldset = True
def id_for_label(self, id_, index=None):
"""
@@ -862,6 +864,7 @@ class MultiWidget(Widget):
"""
template_name = "django/forms/widgets/multiwidget.html"
+ use_fieldset = True
def __init__(self, widgets, attrs=None):
if isinstance(widgets, dict):
@@ -1027,6 +1030,7 @@ class SelectDateWidget(Widget):
input_type = "select"
select_widget = Select
date_re = _lazy_re_compile(r"(\d{4}|0)-(\d\d?)-(\d\d?)$")
+ use_fieldset = True
def __init__(self, attrs=None, years=None, months=None, empty_label=None):
self.attrs = attrs or {}