Changes between Initial Version and Version 1 of Ticket #34705
- Timestamp:
- Jul 11, 2023, 6:39:31 AM (14 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #34705 – Description
initial v1 30 30 Patch: 31 31 32 {{{ 33 diff --git a/django/forms/boundfield.py b/django/forms/boundfield.py 34 index deba739329..b9f29e3da5 100644 32 {{{diff --git a/django/forms/boundfield.py b/django/forms/boundfield.py 33 index deba739329..e4261d5e50 100644 35 34 --- a/django/forms/boundfield.py 36 35 +++ b/django/forms/boundfield.py 37 @@ -290, 7 +290,9@@ class BoundField(RenderableFieldMixin):36 @@ -290,10 +290,11 @@ class BoundField(RenderableFieldMixin): 38 37 # If a custom aria-describedby attribute is given and help_text is 39 38 # used, the custom aria-described by is preserved so user can set the 40 39 # desired order. 41 40 - if custom_aria_described_by_id := widget.attrs.get("aria-describedby"): 42 + if custom_aria_described_by_id := attrs.get( 43 + "aria-describedby" 44 + ) or widget.attrs.get("aria-describedby"): 45 attrs["aria-describedby"] = custom_aria_described_by_id 46 elif self.field.help_text and self.id_for_label: 47 attrs["aria-describedby"] = f"{self.id_for_label}_helptext" 41 - attrs["aria-describedby"] = custom_aria_described_by_id 42 - elif self.field.help_text and self.id_for_label: 43 - attrs["aria-describedby"] = f"{self.id_for_label}_helptext" 44 + if not attrs.get("aria-describedby"): 45 + if custom_aria_described_by_id := widget.attrs.get("aria-describedby"): 46 + attrs["aria-describedby"] = custom_aria_described_by_id 47 + elif self.field.help_text and self.id_for_label: 48 + attrs["aria-describedby"] = f"{self.id_for_label}_helptext" 49 return attrs 50 51 @property 48 52 }}} 49 53