Skip to content

Commit

Permalink
Fixed up some omissions and one mysteriously documented, yet non-exis…
Browse files Browse the repository at this point in the history
…tent field

in the validator documentation. Patch from alang@bright-green.com. Refs django#2266.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5113 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
malcolmt committed Apr 27, 2007
1 parent 8a4a802 commit ec577d8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Expand Up @@ -42,6 +42,7 @@ people who have submitted patches, reported bugs, added translations, helped
answer newbie questions, and generally made Django that much better:

adurdin@gmail.com
alang@bright-green.com
Daniel Alves Barbosa de Oliveira Vaz <danielvaz@gmail.com>
Andreas
andy@jadedplanet.net
Expand Down
20 changes: 12 additions & 8 deletions docs/forms.txt
Expand Up @@ -517,7 +517,7 @@ to put punctuation at the end of your validation messages.
When are validators called?
---------------------------

After a form has been submitted, Django validates each field in turn. First,
After a form has been submitted, Django validates each field in turn. First,
if the field is required, Django checks that it is present and non-empty. Then,
if that test passes *and the form submission contained data* for that field, all
the validators for that field are called in turn. The emphasized portion in the
Expand Down Expand Up @@ -615,15 +615,19 @@ fails. If no message is passed in, a default message is used.
``other_value``, then the validators in ``validator_list`` are all run
against the current field.

``RequiredIfOtherFieldGiven``
Takes a field name of the current field is only required if the other
field has a value.

``RequiredIfOtherFieldsGiven``
Similar to ``RequiredIfOtherFieldGiven``, except that it takes a list of
field names and if any one of the supplied fields has a value provided,
the current field being validated is required.

``RequiredIfOtherFieldNotGiven``
Takes the name of the other field and this field is only required if the
other field has no value.

``RequiredIfOtherFieldsNotGiven``
Similar to ``RequiredIfOtherFieldNotGiven``, except that it takes a list
of field names and if any one of the supplied fields does not have a value
provided, the field being validated is required.

``RequiredIfOtherFieldEquals`` and ``RequiredIfOtherFieldDoesNotEqual``
Each of these validator classes takes a field name and a value (in that
order). If the given field does (or does not have, in the latter case) the
Expand All @@ -650,8 +654,8 @@ fails. If no message is passed in, a default message is used.
``NumberIsInRange``
Takes two boundary numbers, ``lower`` and ``upper``, and checks that the
field is greater than ``lower`` (if given) and less than ``upper`` (if
given).
given).

Both checks are inclusive. That is, ``NumberIsInRange(10, 20)`` will allow
values of both 10 and 20. This validator only checks numeric values
(e.g., float and integer values).
Expand Down

0 comments on commit ec577d8

Please sign in to comment.