summaryrefslogtreecommitdiff
path: root/docs/ref
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2013-04-12 10:13:38 +0200
committerClaude Paroz <claude@2xlibre.net>2013-04-12 10:17:17 +0200
commit0f99246b6f4e7d08600c19fbbeb8feb1a335f985 (patch)
tree37cfd4b21810ddea70aab9e599915d424b5b6a76 /docs/ref
parent712a7927139e3abf9532d73bc88d35e0ebb3a022 (diff)
Documented BoundField.label_tag
Diffstat (limited to 'docs/ref')
-rw-r--r--docs/ref/forms/api.txt13
1 files changed, 13 insertions, 0 deletions
diff --git a/docs/ref/forms/api.txt b/docs/ref/forms/api.txt
index 4c5c275806..34ed2e493e 100644
--- a/docs/ref/forms/api.txt
+++ b/docs/ref/forms/api.txt
@@ -639,6 +639,19 @@ For a field's list of errors, access the field's ``errors`` attribute.
>>> str(f['subject'].errors)
''
+.. method:: BoundField.label_tag(contents=None, attrs=None)
+
+To separately render the label tag of a form field, you can call its
+``label_tag`` method::
+
+ >>> f = ContactForm(data)
+ >>> print(f['message'].label_tag())
+ <label for="id_message">Message</label>
+
+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 ``<label>`` tag.
+
.. method:: BoundField.css_classes()
When you use Django's rendering shortcuts, CSS classes are used to