diff options
| author | David Smith <39445562+smithdc1@users.noreply.github.com> | 2022-01-12 07:07:21 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-12 08:07:21 +0100 |
| commit | 75c1127eef23b32e787cd5dc97f7fa5ddb02bb9f (patch) | |
| tree | 386ed73f183db581494fadd083f3b6df968e6a64 /docs/topics/forms | |
| parent | 367d6920ece44639e54650d9a98f8c24e10f7229 (diff) | |
Alphabetized field attributes in form topic docs.
Diffstat (limited to 'docs/topics/forms')
| -rw-r--r-- | docs/topics/forms/index.txt | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/docs/topics/forms/index.txt b/docs/topics/forms/index.txt index 8ed99d5773..d87b9be8d6 100644 --- a/docs/topics/forms/index.txt +++ b/docs/topics/forms/index.txt @@ -640,15 +640,24 @@ loop: Useful attributes on ``{{ field }}`` include: -``{{ field.label }}`` - The label of the field, e.g. ``Email address``. +``{{ field.errors }}`` + Outputs a ``<ul class="errorlist">`` containing any validation errors + corresponding to this field. You can customize the presentation of + the errors with a ``{% for error in field.errors %}`` loop. In this + case, each object in the loop is a string containing the error message. -``{{ field.label_tag }}`` - The field's label wrapped in the appropriate HTML ``<label>`` tag. This - includes the form's :attr:`~django.forms.Form.label_suffix`. For example, - the default ``label_suffix`` is a colon:: +``{{ field.field }}`` + The :class:`~django.forms.Field` instance from the form class that + this :class:`~django.forms.BoundField` wraps. You can use it to access + :class:`~django.forms.Field` attributes, e.g. + ``{{ char_field.field.max_length }}``. - <label for="id_email">Email address:</label> +``{{ field.help_text }}`` + Any help text that has been associated with the field. + +``{{ field.html_name }}`` + The name of the field that will be used in the input element's name + field. This takes the form prefix into account, if it has been set. ``{{ field.id_for_label }}`` The ID that will be used for this field (``id_email`` in the example @@ -656,22 +665,6 @@ Useful attributes on ``{{ field }}`` include: this in lieu of ``label_tag``. It's also useful, for example, if you have some inline JavaScript and want to avoid hardcoding the field's ID. -``{{ field.value }}`` - The value of the field. e.g ``someone@example.com``. - -``{{ field.html_name }}`` - The name of the field that will be used in the input element's name - field. This takes the form prefix into account, if it has been set. - -``{{ field.help_text }}`` - Any help text that has been associated with the field. - -``{{ field.errors }}`` - Outputs a ``<ul class="errorlist">`` containing any validation errors - corresponding to this field. You can customize the presentation of - the errors with a ``{% for error in field.errors %}`` loop. In this - case, each object in the loop is a string containing the error message. - ``{{ field.is_hidden }}`` This attribute is ``True`` if the form field is a hidden field and ``False`` otherwise. It's not particularly useful as a template @@ -683,11 +676,18 @@ Useful attributes on ``{{ field }}`` include: {# Do something special #} {% endif %} -``{{ field.field }}`` - The :class:`~django.forms.Field` instance from the form class that - this :class:`~django.forms.BoundField` wraps. You can use it to access - :class:`~django.forms.Field` attributes, e.g. - ``{{ char_field.field.max_length }}``. +``{{ field.label }}`` + The label of the field, e.g. ``Email address``. + +``{{ field.label_tag }}`` + The field's label wrapped in the appropriate HTML ``<label>`` tag. This + includes the form's :attr:`~django.forms.Form.label_suffix`. For example, + the default ``label_suffix`` is a colon:: + + <label for="id_email">Email address:</label> + +``{{ field.value }}`` + The value of the field. e.g ``someone@example.com``. .. seealso:: |
