diff --git a/docs/ref/forms/api.txt b/docs/ref/forms/api.txt index 9dcfbcfb09c..d80d9ea2242 100644 --- a/docs/ref/forms/api.txt +++ b/docs/ref/forms/api.txt @@ -1210,6 +1210,29 @@ Methods of ``BoundField`` .. method:: BoundField.label_tag(contents=None, attrs=None, label_suffix=None) + Renders a label tag for the form field using the template specified by + :attr:`.Form.template_name_label`. + + The available context is: + + * ``field``: This instance of the :class:`BoundField`. + * ``contents``: By default a concatenated string of + :attr:`BoundField.label` and :attr:`Form.label_suffix` (or + :attr:`Field.label_suffix`, if set). This can be overridden by the + ``contents`` and ``label_suffix`` arguments. + * ``attrs``: A ``dict`` containing ``for``, + :attr:`Form.required_css_class`, and ``id``. ``id`` is generated by the + field's widget ``attrs`` or :attr:`BoundField.auto_id`. Additional + attributes can be provided by the ``attrs`` argument. + * ``use_tag``: A boolean which is ``True`` if the label has an ``id``. + If ``False`` the default template omits the ``