Fixed #18134 -- Inconsistent label_tag generation on form fields #141

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
2 participants
@gabejackson
Contributor

gabejackson commented Jun 8, 2012

There was an inconsistency between how the label_tag for forms were
generated depending on which method was used: as_p, as_ul and as_table
contained code to append the label_suffix where as label_tag called on a
form field directly did NOT append the label_suffix. The code for
appending the label_suffix has been moved in to the label_tag code of
the field and the HTML generation code for as_p, as_ul and as_table now
calls this code as well. CAUTION: This may be be "backwards incompatible
change" because users who have added the label_suffix manually in their
templates may now get double label_suffix characters in their forms.

Also some test cases regarding the label_tag output were inconsistent.
Some expected Label: and some expected the label_suffix
outside of the tag: Label:
The format has now been unified to keep the label_suffix inside the
tag: Label:. If the label_suffix is not needed,
the form can still be constructed with label_suffix=''.

gabejackson added some commits Jun 8, 2012

Fixed #18134 -- Inconsistent label_tag generation on form fields
There was an inconsistency between how the label_tag for forms were
generated depending on which method was used: as_p, as_ul and as_table
contained code to append the label_suffix where as label_tag called on a
form field directly did NOT append the label_suffix. The code for
appending the label_suffix has been moved in to the label_tag code of
the field and the HTML generation code for as_p, as_ul and as_table now
calls this code as well. CAUTION: This may be be "backwards incompatible
change" because users who have added the label_suffix manually in their
templates may now get double label_suffix characters in their forms.

Also some test cases regarding the label_tag output were inconsistent.
Some expected <label>Label:</label> and some expected the label_suffix
outside of the <label> tag: <label>Label</label>:
The format has now been unified to keep the label_suffix inside the
<label> tag: <label>Label:</label>. If the label_suffix is not needed,
the form can still be constructed with label_suffix=''.
Documentation for ticket #18134
Removed the extra ':' from the template examples in the forms
documentation. Noted that the label_tag template tag also outputs the
label_suffix.
@timgraham

This comment has been minimized.

Show comment
Hide comment
@timgraham

timgraham Jun 7, 2013

Member

I've added additional docs for this change and updated it to merge cleanly: #1252

Member

timgraham commented Jun 7, 2013

I've added additional docs for this change and updated it to merge cleanly: #1252

@timgraham timgraham closed this Jun 7, 2013

sztrovacsek pushed a commit to sztrovacsek/django that referenced this pull request Mar 7, 2015

Merge pull request #141 from LeMeteore/add-my-name
Update attendees_and_learners.rst

nanuxbe pushed a commit to nanuxbe/django that referenced this pull request Jul 2, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment