mirror of https://github.com/django/django.git
Clarified the wording of the section on customizing form.errors within a field loop
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9032 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
5389c0d2af
commit
6fcdcbd456
|
@ -267,12 +267,9 @@ reduce duplicate code by looping through each field in turn using
|
||||||
<p><input type="submit" value="Send message"></p>
|
<p><input type="submit" value="Send message"></p>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
As in the above example, {{ field.errors }} will output a
|
Within this loop, ``{{ field }}`` is an instance of :class:`BoundField`.
|
||||||
``<ul class="errorlist">`` by default. You can further customise the display
|
``BoundField`` also has the following attributes which can be useful in your
|
||||||
of errors with a ``{% for error in field.errors %}`` loop.
|
templates:
|
||||||
|
|
||||||
Within this loop, ``{{ field }}`` is an instance of BoundField. BoundField
|
|
||||||
also has the following attributes which can be useful in your templates:
|
|
||||||
|
|
||||||
``{{ field.label }}``
|
``{{ field.label }}``
|
||||||
The label of the field, e.g. ``Name``.
|
The label of the field, e.g. ``Name``.
|
||||||
|
@ -285,9 +282,14 @@ also has the following attributes which can be useful in your templates:
|
||||||
The name of the field that will be used in the input element's name
|
The name of the field that will be used in the input element's name
|
||||||
field; this takes the form prefix in to account if it has been set.
|
field; this takes the form prefix in to account if it has been set.
|
||||||
|
|
||||||
``{{ field.help_text}}``
|
``{{ field.help_text }}``
|
||||||
Any help text that has been associated with the field.
|
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.
|
||||||
|
|
||||||
Further topics
|
Further topics
|
||||||
==============
|
==============
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue