From 584bd14dcfdee9585fec7794d53ce120ea73d0bc Mon Sep 17 00:00:00 2001 From: Gabe Jackson Date: Fri, 8 Jun 2012 15:32:35 +0200 Subject: Fixed #18134 -- BoundField.label_tag now includes the form's label_suffix 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. This is a 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. --- docs/ref/forms/api.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'docs/ref/forms') diff --git a/docs/ref/forms/api.txt b/docs/ref/forms/api.txt index c05430c64e..3c17827800 100644 --- a/docs/ref/forms/api.txt +++ b/docs/ref/forms/api.txt @@ -498,6 +498,8 @@ include ``%s`` -- then the library will act as if ``auto_id`` is ``True``. By default, ``auto_id`` is set to the string ``'id_%s'``. +.. attribute:: Form.label_suffix + Normally, a colon (``:``) will be appended after any label name when a form is rendered. It's possible to change the colon to another character, or omit it entirely, using the ``label_suffix`` parameter:: @@ -650,12 +652,17 @@ To separately render the label tag of a form field, you can call its >>> f = ContactForm(data) >>> print(f['message'].label_tag()) - + Optionally, you can provide the ``contents`` parameter which will replace the auto-generated label tag. An optional ``attrs`` dictionary may contain additional attributes for the ``