mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +00:00
Fixed #19581 -- ensure unique html ids with CheckboxSelectMultiple widgets
ID check is now done the same way as MultipleHiddenInput.
This commit is contained in:
parent
227bd3f8db
commit
62f842e2e5
2 changed files with 11 additions and 4 deletions
|
@ -861,6 +861,13 @@ beatle J R Ringo False""")
|
|||
<li><label for="abc_0"><input checked="checked" type="checkbox" name="letters" value="a" id="abc_0" /> A</label></li>
|
||||
<li><label for="abc_1"><input type="checkbox" name="letters" value="b" id="abc_1" /> B</label></li>
|
||||
<li><label for="abc_2"><input checked="checked" type="checkbox" name="letters" value="c" id="abc_2" /> C</label></li>
|
||||
</ul>""")
|
||||
|
||||
# Each input gets a separate ID when the ID is passed to the constructor
|
||||
self.assertHTMLEqual(CheckboxSelectMultiple(attrs={'id': 'abc'}).render('letters', list('ac'), choices=zip(list('abc'), list('ABC'))), """<ul>
|
||||
<li><label for="abc_0"><input checked="checked" type="checkbox" name="letters" value="a" id="abc_0" /> A</label></li>
|
||||
<li><label for="abc_1"><input type="checkbox" name="letters" value="b" id="abc_1" /> B</label></li>
|
||||
<li><label for="abc_2"><input checked="checked" type="checkbox" name="letters" value="c" id="abc_2" /> C</label></li>
|
||||
</ul>""")
|
||||
|
||||
def test_multi(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue