My opinion is that
[[https://docs.djangoproject.com/en/4.1/ref/forms/widgets/#django.forms.Widget.render|`Widget.render`]]
should be passed the corresponding `BoundField` instance.
This would, I think, have 2 benefits:
1. allow easier rendering of complex widgets like
[https://github.com/django/django/blob/main/django/forms/widgets.py#L585
ChoiceWidget] using an iteration on the
[https://github.com/django/django/blob/main/django/forms/boundfield.py#L59-L60
BoundField]
([https://docs.djangoproject.com/en/4.1/ref/forms/widgets/#radioselect
which is what's documented] and would allow unification with
[https://github.com/django/django/blob/main/django/forms/widgets.py#L616-L659
ChoiceWidget.options and ChoiceWidget.optgroups])
2. allow rendering together `Form` fields that are related since
`BoundField` has access to the parent `Form` (for instance a form with
three options: email, phone, and other, respectively related to an email
input, a phone input and a text input that are displayed below each).
P.S.: This is a feature request but I'm still opening a bug here since I
can't join the django-developers mailing-list without a Google account.
--
Ticket URL: <https://code.djangoproject.com/ticket/34426>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* resolution: => duplicate
Comment:
Duplicate of #33166 (see also #34077).
--
Ticket URL: <https://code.djangoproject.com/ticket/34426#comment:1>