mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +00:00
Fixed #29200 -- Fixed label rendering when using RadioSelect and CheckboxSelectMultiple with MultiWidget.
This commit is contained in:
parent
fb8fd535c0
commit
87dc0844a6
7 changed files with 32 additions and 5 deletions
|
@ -1,6 +1,6 @@
|
|||
import datetime
|
||||
|
||||
from django.forms import RadioSelect
|
||||
from django.forms import MultiWidget, RadioSelect
|
||||
from django.test import override_settings
|
||||
|
||||
from .base import WidgetTest
|
||||
|
@ -130,3 +130,16 @@ class RadioSelectTest(WidgetTest):
|
|||
</ul>
|
||||
"""
|
||||
self.check_html(self.widget(choices=choices), 'time', None, html=html)
|
||||
|
||||
def test_render_as_subwidget(self):
|
||||
"""A RadioSelect as a subwidget of MultiWidget."""
|
||||
choices = (('', '------'),) + self.beatles
|
||||
self.check_html(MultiWidget([self.widget(choices=choices)]), 'beatle', ['J'], html=(
|
||||
"""<ul>
|
||||
<li><label><input type="radio" name="beatle_0" value=""> ------</label></li>
|
||||
<li><label><input checked type="radio" name="beatle_0" value="J"> John</label></li>
|
||||
<li><label><input type="radio" name="beatle_0" value="P"> Paul</label></li>
|
||||
<li><label><input type="radio" name="beatle_0" value="G"> George</label></li>
|
||||
<li><label><input type="radio" name="beatle_0" value="R"> Ringo</label></li>
|
||||
</ul>"""
|
||||
))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue