1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Refs #32339 -- Added use_fieldset to Widget.

This commit is contained in:
David
2022-01-13 23:08:38 +00:00
committed by Carlton Gibson
parent 04ad0f26ba
commit c8459708a7
28 changed files with 489 additions and 22 deletions

View File

@@ -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:

View File

@@ -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 {}