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:18:24 +0200
commit991432ee8ab49eca76113f0b6c23e885ea316507 (patch)
treec9eeaf9d966354bdf9647877f08353a195aa7cdf /docs/ref
parent709ee83cd3ccbaeabcfcbb9391bb72d1bcaf01d3 (diff)
[1.5.x] Documented BoundField.label_tag
Backport of 0f99246b6 from master.
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 d1f877ff65..8d9e43bd3b 100644
--- a/docs/ref/forms/api.txt
+++ b/docs/ref/forms/api.txt
@@ -638,6 +638,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