Fixed #14708 - Document available keys for form field error messages; thanks adamv.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15080 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
4919aaee11
commit
b0ecab516f
|
@ -340,6 +340,9 @@ Has two optional arguments for validation:
|
||||||
* Validates that the given value exists in the list of choices.
|
* Validates that the given value exists in the list of choices.
|
||||||
* Error message keys: ``required``, ``invalid_choice``
|
* Error message keys: ``required``, ``invalid_choice``
|
||||||
|
|
||||||
|
The ``invalid_choice`` error message may contain ``%(value)s``, which will be
|
||||||
|
replaced with the selected choice.
|
||||||
|
|
||||||
Takes one extra required argument:
|
Takes one extra required argument:
|
||||||
|
|
||||||
.. attribute:: ChoiceField.choices
|
.. attribute:: ChoiceField.choices
|
||||||
|
@ -449,6 +452,9 @@ If no ``input_formats`` argument is provided, the default input formats are::
|
||||||
``min_value``, ``max_digits``, ``max_decimal_places``,
|
``min_value``, ``max_digits``, ``max_decimal_places``,
|
||||||
``max_whole_digits``
|
``max_whole_digits``
|
||||||
|
|
||||||
|
The ``max_value`` and ``min_value`` error messages may contain
|
||||||
|
``%(limit_value)s``, which will be substituted by the appropriate limit.
|
||||||
|
|
||||||
Takes four optional arguments:
|
Takes four optional arguments:
|
||||||
|
|
||||||
.. attribute:: DecimalField.max_value
|
.. attribute:: DecimalField.max_value
|
||||||
|
@ -497,7 +503,8 @@ given length.
|
||||||
* Normalizes to: An ``UploadedFile`` object that wraps the file content
|
* Normalizes to: An ``UploadedFile`` object that wraps the file content
|
||||||
and file name into a single object.
|
and file name into a single object.
|
||||||
* Validates that non-empty file data has been bound to the form.
|
* Validates that non-empty file data has been bound to the form.
|
||||||
* Error message keys: ``required``, ``invalid``, ``missing``, ``empty``
|
* Error message keys: ``required``, ``invalid``, ``missing``, ``empty``,
|
||||||
|
``max_length``
|
||||||
|
|
||||||
To learn more about the ``UploadedFile`` object, see the :doc:`file uploads
|
To learn more about the ``UploadedFile`` object, see the :doc:`file uploads
|
||||||
documentation </topics/http/file-uploads>`.
|
documentation </topics/http/file-uploads>`.
|
||||||
|
@ -505,6 +512,10 @@ documentation </topics/http/file-uploads>`.
|
||||||
When you use a ``FileField`` in a form, you must also remember to
|
When you use a ``FileField`` in a form, you must also remember to
|
||||||
:ref:`bind the file data to the form <binding-uploaded-files>`.
|
:ref:`bind the file data to the form <binding-uploaded-files>`.
|
||||||
|
|
||||||
|
The ``max_length`` error refers to the length of the filename. In the error
|
||||||
|
message for that key, ``%(max)d`` will be replaced with the maximum filename
|
||||||
|
length and ``%(length)d`` will be replaced with the current filename length.
|
||||||
|
|
||||||
``FilePathField``
|
``FilePathField``
|
||||||
~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
@ -583,6 +594,9 @@ When you use an ``ImageField`` on a form, you must also remember to
|
||||||
* Error message keys: ``required``, ``invalid``, ``max_value``,
|
* Error message keys: ``required``, ``invalid``, ``max_value``,
|
||||||
``min_value``
|
``min_value``
|
||||||
|
|
||||||
|
The ``max_value`` and ``min_value`` error messages may contain
|
||||||
|
``%(limit_value)s``, which will be substituted by the appropriate limit.
|
||||||
|
|
||||||
Takes two optional arguments for validation:
|
Takes two optional arguments for validation:
|
||||||
|
|
||||||
.. attribute:: IntegerField.max_value
|
.. attribute:: IntegerField.max_value
|
||||||
|
@ -614,6 +628,9 @@ Takes two optional arguments for validation:
|
||||||
of choices.
|
of choices.
|
||||||
* Error message keys: ``required``, ``invalid_choice``, ``invalid_list``
|
* Error message keys: ``required``, ``invalid_choice``, ``invalid_list``
|
||||||
|
|
||||||
|
The ``invalid_choice`` error message may contain ``%(value)s``, which will be
|
||||||
|
replaced with the selected choice.
|
||||||
|
|
||||||
Takes one extra required argument, ``choices``, as for ``ChoiceField``.
|
Takes one extra required argument, ``choices``, as for ``ChoiceField``.
|
||||||
|
|
||||||
``TypedMultipleChoiceField``
|
``TypedMultipleChoiceField``
|
||||||
|
@ -632,6 +649,9 @@ takes two extra arguments, ``coerce`` and ``empty_value``.
|
||||||
coerced.
|
coerced.
|
||||||
* Error message keys: ``required``, ``invalid_choice``
|
* Error message keys: ``required``, ``invalid_choice``
|
||||||
|
|
||||||
|
The ``invalid_choice`` error message may contain ``%(value)s``, which will be
|
||||||
|
replaced with the selected choice.
|
||||||
|
|
||||||
Takes two extra arguments, ``coerce`` and ``empty_value``, as for ``TypedChoiceField``.
|
Takes two extra arguments, ``coerce`` and ``empty_value``, as for ``TypedChoiceField``.
|
||||||
|
|
||||||
``NullBooleanField``
|
``NullBooleanField``
|
||||||
|
|
Loading…
Reference in New Issue