Edited docs/newforms.txt changes from [6740]
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6803 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
5e06c129c6
commit
0e464d5d5c
|
@ -756,8 +756,9 @@ For example::
|
||||||
Highlighting required fields in templates
|
Highlighting required fields in templates
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
You may wish to show a visitor which fields are required. Here is the above
|
It's common to show a user which fields are required. Here's an example of how
|
||||||
example modified to insert an asterix after the label of each required field::
|
to do that, using the above example modified to insert an asterisk after the
|
||||||
|
label of each required field::
|
||||||
|
|
||||||
<form method="post" action="">
|
<form method="post" action="">
|
||||||
<dl>
|
<dl>
|
||||||
|
@ -772,10 +773,11 @@ example modified to insert an asterix after the label of each required field::
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
The ``{% if field.field.required %}*{% endif %}`` fragment is the relevant
|
The ``{% if field.field.required %}*{% endif %}`` fragment is the relevant
|
||||||
addition here. It adds the asterix only if the field is required. Note that we
|
addition here. It adds the asterisk only if the field is required.
|
||||||
check ``field.field.required`` and not ``field.required``. In the template,
|
|
||||||
``field`` is a ``newforms.forms.BoundField`` instance, which holds the actual
|
Note that we check ``field.field.required`` and not ``field.required``. In the
|
||||||
``Field`` instance in its ``field`` attribute.
|
template, ``field`` is a ``newforms.forms.BoundField`` instance, which holds
|
||||||
|
the actual ``Field`` instance in its ``field`` attribute.
|
||||||
|
|
||||||
Binding uploaded files to a form
|
Binding uploaded files to a form
|
||||||
--------------------------------
|
--------------------------------
|
||||||
|
|
Loading…
Reference in New Issue