Author: timo
Date: 2010-12-28 15:16:25 -0600 (Tue, 28 Dec 2010)
New Revision: 15081
Modified:
django/branches/releases/1.2.X/docs/ref/forms/fields.txt
Log:
[1.2.X] Fixed #14708 - Document available keys for form field error messages;
thanks adamv.
Backport of r15080 from trunk.
Modified: django/branches/releases/1.2.X/docs/ref/forms/fields.txt
===================================================================
--- django/branches/releases/1.2.X/docs/ref/forms/fields.txt 2010-12-28
21:10:19 UTC (rev 15080)
+++ django/branches/releases/1.2.X/docs/ref/forms/fields.txt 2010-12-28
21:16:25 UTC (rev 15081)
@@ -340,6 +340,9 @@
* Validates that the given value exists in the list of choices.
* 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:
.. attribute:: ChoiceField.choices
@@ -452,6 +455,9 @@
``min_value``, ``max_digits``, ``max_decimal_places``,
``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:
.. attribute:: DecimalField.max_value
@@ -500,7 +506,8 @@
* Normalizes to: An ``UploadedFile`` object that wraps the file content
and file name into a single object.
* 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
documentation </topics/http/file-uploads>`.
@@ -508,6 +515,10 @@
When you use a ``FileField`` in a form, you must also remember to
: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``
~~~~~~~~~~~~~~~~~
@@ -586,6 +597,9 @@
* Error message keys: ``required``, ``invalid``, ``max_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:
.. attribute:: IntegerField.max_value
@@ -617,8 +631,11 @@
of choices.
* Error message keys: ``required``, ``invalid_choice``, ``invalid_list``
-Takes one extra argument, ``choices``, as for ``ChoiceField``.
+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``.
+
``NullBooleanField``
~~~~~~~~~~~~~~~~~~~~
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.