CheckboxSelectMultiple Widget Bug

46 views
Skip to first unread message

Dylan Young

unread,
Jun 22, 2017, 4:58:33 PM6/22/17
to django-d...@googlegroups.com
Hey all:

Just wanted to check in about a potential bug before I file it in the bug tracker; it's potentially fixed already since I'm working on Django 1.8, but I can't see any record of the bug, so wanted to see if it's come up. 

The CheckboxSelectMultiple widget doesn't seem to apply attrs correctly (i.e. on the input elements) or at all that I can see (though I just looked quickly). 

Is this a known bug?

Best,

Casey Meijer

Tim Graham

unread,
Jun 22, 2017, 9:23:00 PM6/22/17
to Django developers (Contributions to Django itself)
It's helpful if you can include steps to reproduce the issue. Here's what I see on master. I also see the same on 1.8, besides some whitespace differences due to template-based widget rendering that's new in Django 1.11.

>>> from django.forms import CheckboxSelectMultiple
>>> w = CheckboxSelectMultiple(attrs={'foo': 'bar'})
>>> w = CheckboxSelectMultiple(attrs={'foo': 'bar'}, choices=[('foo', 'bar')])
>>> w.render('name', 'value')
'<ul>\n    <li><label><input type="checkbox" name="name" value="foo" foo="bar" />\n bar</label>\n\n</li>\n</ul>'
Reply all
Reply to author
Forward
0 new messages