summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2007-12-01 16:52:49 +0000
committerAdrian Holovaty <adrian@holovaty.com>2007-12-01 16:52:49 +0000
commite7bc0f10ace2e62b53f9fdf764107aabfd53e617 (patch)
tree71522b282cd952de07a9a58d6d1aa612e405a6d4 /docs
parent394807866de4b9841ec67e0c28e53d49964629ce (diff)
Edited docs/newforms.txt changes from [6625]
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6786 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
-rw-r--r--docs/newforms.txt10
1 files changed, 6 insertions, 4 deletions
diff --git a/docs/newforms.txt b/docs/newforms.txt
index e27514cdba..f26afcb6db 100644
--- a/docs/newforms.txt
+++ b/docs/newforms.txt
@@ -1105,9 +1105,9 @@ fields. We've specified ``auto_id=False`` to simplify the output::
**New in Django development version**
-The ``error_messages`` argument lets you override the default messages which the
+The ``error_messages`` argument lets you override the default messages that the
field will raise. Pass in a dictionary with keys matching the error messages you
-want to override. For example::
+want to override. For example, here is the default error message::
>>> generic = forms.CharField()
>>> generic.clean('')
@@ -1115,14 +1115,16 @@ want to override. For example::
...
ValidationError: [u'This field is required.']
+And here is a custom error message::
+
>>> name = forms.CharField(error_messages={'required': 'Please enter your name'})
>>> name.clean('')
Traceback (most recent call last):
...
ValidationError: [u'Please enter your name']
-In the `built-in Field classes`_ section below, each Field defines the error
-message keys it uses.
+In the `built-in Field classes`_ section below, each ``Field`` defines the
+error message keys it uses.
Dynamic initial values
----------------------