diff options
| author | antoliny0919 <antoliny0919@gmail.com> | 2025-07-28 07:59:26 +0900 |
|---|---|---|
| committer | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> | 2025-08-19 16:35:56 +0200 |
| commit | 4187da258fe212d494cb578a0bc2b52c4979ab95 (patch) | |
| tree | 67f6205a16b1f6785f1ed4e06348d332c36a50f3 /django/contrib/admin/helpers.py | |
| parent | ad4a9e0f3b1de261409bc083aa49dba705531824 (diff) | |
Fixed #35892 -- Supported Widget.use_fieldset in admin forms.
Diffstat (limited to 'django/contrib/admin/helpers.py')
| -rw-r--r-- | django/contrib/admin/helpers.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/django/contrib/admin/helpers.py b/django/contrib/admin/helpers.py index 969167f0e2..bd37f519cd 100644 --- a/django/contrib/admin/helpers.py +++ b/django/contrib/admin/helpers.py @@ -173,6 +173,7 @@ class AdminField: self.is_first = is_first # Whether this field is first on the line self.is_checkbox = isinstance(self.field.field.widget, forms.CheckboxInput) self.is_readonly = False + self.is_fieldset = self.field.field.widget.use_fieldset def label_tag(self): classes = [] @@ -185,12 +186,14 @@ class AdminField: if not self.is_first: classes.append("inline") attrs = {"class": " ".join(classes)} if classes else {} + tag = "legend" if self.is_fieldset else None # checkboxes should not have a label suffix as the checkbox appears # to the left of the label. return self.field.label_tag( contents=mark_safe(contents), attrs=attrs, label_suffix="" if self.is_checkbox else None, + tag=tag, ) def errors(self): |
