#29200: RadioSelect does not render its label in MultiWidget
------------------------------------------+------------------------
               Reporter:  Takayuki Hirai  |          Owner:  nobody
                   Type:  Uncategorized   |         Status:  new
              Component:  Forms           |        Version:  1.11
               Severity:  Normal          |       Keywords:
           Triage Stage:  Unreviewed      |      Has patch:  0
    Needs documentation:  0               |    Needs tests:  0
Patch needs improvement:  0               |  Easy pickings:  0
                  UI/UX:  0               |
------------------------------------------+------------------------
 The code:

 {{{
 #!python
 from django import forms


 class MyWidget(forms.MultiWidget):
     def __init__(self):
         widgets = [
             forms.RadioSelect(
                 choices=[('aaa', 'bbb')]
             )
         ]
         super(MyWidget, self).__init__(
             widgets=widgets,
             attrs={},
         )

     def decompress(self, v):
         return []


 print(MyWidget().render('wname', None))
 }}}

 Actual output:

 {{{
 <ul>
     <li><input type="radio" name="wname_0" value="aaa" />


 </li>
 </ul>
 }}}

 Expected output:

 {{{
 <ul>
     <li><label><input type="radio" name="wname_0" value="aaa" />
  bbb</label>

 </li>
 </ul>
 }}}

 It seems that this problem is caused by the following reasons:

 - a template of {{{RadioSelect}}} requires {{{wrap_label}}} context
 varialbe to render LABEL elements
 -  {{{MultiWidget.get_context()}}} drops {{{wrap_label}}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29200>
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/049.04a5f07ccc5dde36712395118257e3c8%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to