diff options
| author | Kasyap Pentamaraju <vpentamaraju@webmd.net> | 2025-11-11 14:59:28 +0530 |
|---|---|---|
| committer | Jacob Walls <jacobtylerwalls@gmail.com> | 2025-11-13 11:22:44 -0500 |
| commit | 0eec2a163a4b2ea4e82c53ae1d7b71bf43ac911d (patch) | |
| tree | af9b9ddbdfcab0434759246d6114c483407aca19 /django | |
| parent | 7e765a68598b2b798e49bf1f4b431a7bcac085a4 (diff) | |
Fixed #36724 -- Removed invalid "for" attribute on <legend> tags.
Diffstat (limited to 'django')
| -rw-r--r-- | django/forms/boundfield.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/django/forms/boundfield.py b/django/forms/boundfield.py index 97559fe286..5b8e7e5697 100644 --- a/django/forms/boundfield.py +++ b/django/forms/boundfield.py @@ -192,7 +192,9 @@ class BoundField(RenderableFieldMixin): if id_: id_for_label = widget.id_for_label(id_) if id_for_label: - attrs = {**(attrs or {}), "for": id_for_label} + attrs = attrs or {} + if tag != "legend": + attrs = {**attrs, "for": id_for_label} if self.field.required and hasattr(self.form, "required_css_class"): attrs = attrs or {} if "class" in attrs: |
