Not related to the discussion but for the accuracy's sake I'd like to
note that right now Django produces <label> without for=".." at all
which this bug is about.
Which is correct and desired. If not Internet Explorer, even for="..."
and id="..." wouldn't be needed (and it's not there with current
IE is the only browser that can't match a label with the contained
input field and also the only one that needs for="..." in this case.
> All of my css research and experience uses this arrangement:
> <li><input type="radio" id="id_language_0" value="P" name="language" /
> > <label for="id_language_0">Python</label></li>
Which is also correct but slightly less desired.
So please count me as -1.
PLD Linux Distribution
BTW, in current Django presence of for and id should be controlled by an
auto_id parameter of a form. However RadioSelect and
CheckboxSelectMultiple are the only controls that don't respect it on
Okay, I think my brain just melted trying to follow the various
sub-problems mentioned here. Can somebody make sure that whatever issues
are brought up here are turned into tickets, if they don't already
exist? This thread has become a maze of twisty passages, all alike, in
only four messages. It can only get worse. :-(
Depression is merely anger without enthusiasm.
I'll try to clarify since it looks that I'm responsible for most of the
1. There is a bug: RadioInput and CheckboxSelectMultiple don't respect
auto_id setting, they always output labels without "for":
<li><label><input ... id="some_0"></label></li>
2. Ticket 4860 exists to fix this bug. It has two patches both fixing
the problem but in different ways:
- one (ca2.diff) makes output like this:
<li><input ... id="some_0"><label for="some_0"></label></li>
- another (4860.diff) retains <input> inside <label>:
<li><label for="some_0"><input ... id="some_0"></label></li>
The latter patch is mine and my reasoning behind this is simply
consistency: Django wraps <label> around <input> everywhere.
3. This thread was started by the author of the first patch to discuss
whether Django should or should not wrap <label>s around <input>s in
general. This is a more general question that was inspired by but is not
related to the ticket.