|
@@ -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::
|
|
|
|