From cad376f844c7bdeeee7607a7c0ea8ae52061309b Mon Sep 17 00:00:00 2001 From: David Smith Date: Wed, 2 Nov 2022 20:13:16 +0000 Subject: Fixed #34077 -- Added form field rendering. --- docs/ref/forms/api.txt | 40 ++++++++++++++++++++++++++++++++++++++++ docs/ref/forms/fields.txt | 13 +++++++++++++ docs/ref/forms/renderers.txt | 31 +++++++++++++++++++++++++++++++ 3 files changed, 84 insertions(+) (limited to 'docs/ref/forms') diff --git a/docs/ref/forms/api.txt b/docs/ref/forms/api.txt index 12754dbae5..4d4f73d0b4 100644 --- a/docs/ref/forms/api.txt +++ b/docs/ref/forms/api.txt @@ -1257,6 +1257,16 @@ Attributes of ``BoundField`` >>> print(f["message"].name) message +.. attribute:: BoundField.template_name + + .. versionadded:: 5.0 + + The name of the template rendered with :meth:`.BoundField.as_field_group`. + + A property returning the value of the + :attr:`~django.forms.Field.template_name` if set otherwise + :attr:`~django.forms.renderers.BaseRenderer.field_template_name`. + .. attribute:: BoundField.use_fieldset Returns the value of this BoundField widget's ``use_fieldset`` attribute. @@ -1281,6 +1291,15 @@ Attributes of ``BoundField`` Methods of ``BoundField`` ------------------------- +.. method:: BoundField.as_field_group() + + .. versionadded:: 5.0 + + Renders the field using :meth:`.BoundField.render` with default values + which renders the ``BoundField``, including its label, help text and errors + using the template's :attr:`~django.forms.Field.template_name` if set + otherwise :attr:`~django.forms.renderers.BaseRenderer.field_template_name` + .. method:: BoundField.as_hidden(attrs=None, **kwargs) Returns a string of HTML for representing this as an ````. @@ -1321,6 +1340,13 @@ Methods of ``BoundField`` >>> f["message"].css_classes("foo bar") 'foo bar required' +.. method:: BoundField.get_context() + + .. versionadded:: 5.0 + + Return the template context for rendering the field. The available context + is ``field`` being the instance of the bound field. + .. method:: BoundField.label_tag(contents=None, attrs=None, label_suffix=None, tag=None) Renders a label tag for the form field using the template specified by @@ -1368,6 +1394,20 @@ Methods of ``BoundField`` checkbox widgets where ```` may be more appropriate than a ``