#26927: Subwidgets not passed required and disabled attributes in
BoundField.__iter__()
----------------------------+--------------------
     Reporter:  jdufresne   |      Owner:  nobody
         Type:  Bug         |     Status:  new
    Component:  Forms       |    Version:  master
     Severity:  Normal      |   Keywords:
 Triage Stage:  Unreviewed  |  Has patch:  0
Easy pickings:  0           |      UI/UX:  0
----------------------------+--------------------
 Similar in spirit to #20555.

 I have a form with a field like:

 {{{
 my_field = forms.ChoiceField(widget=forms.RadioSelect,
 choice=get_choices(), disabled=True)
 }}}

 The field's radio buttons are rendered in a template by iterating over the
 `BoundField`:

 {{{
 {% for choice in form.my_field %}
   {{ choice.tag }}
 {% endfor %}
 }}}

 The rendered HTML input is not disabled. This is because
 
[https://github.com/django/django/blob/bc1e9e823b7dd3fa68dc1678edeb09e2ae1a990c/django/forms/boundfield.py#L45-L55
 BoundField.__iter__()] does not pass the `required` and `disabled`
 attributes to subwidgets.

 Contrast this with
 
[https://github.com/django/django/blob/bc1e9e823b7dd3fa68dc1678edeb09e2ae1a990c/django/forms/boundfield.py#L75-L103
 BoundField.as_widget()] where the values are passed.

 Perhaps this attribute building should be factored to a utility function
 out and shared across these two functions.

--
Ticket URL: <https://code.djangoproject.com/ticket/26927>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/052.c2f95c13f70e4c56c26b701ac2a0e656%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to