Author: adrian
Date: 2007-12-01 10:52:49 -0600 (Sat, 01 Dec 2007)
New Revision: 6786
Modified:
django/trunk/docs/newforms.txt
Log:
Edited docs/newforms.txt changes from [6625]
Modified: django/trunk/docs/newforms.txt
===================================================================
--- django/trunk/docs/newforms.txt 2007-12-01 16:50:48 UTC (rev 6785)
+++ django/trunk/docs/newforms.txt 2007-12-01 16:52:49 UTC (rev 6786)
@@ -1105,9 +1105,9 @@
**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 @@
...
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
----------------------
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---