From e7bc0f10ace2e62b53f9fdf764107aabfd53e617 Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Sat, 1 Dec 2007 16:52:49 +0000 Subject: [PATCH] Edited docs/newforms.txt changes from [6625] git-svn-id: http://code.djangoproject.com/svn/django/trunk@6786 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- docs/newforms.txt | 10 ++++++---- 1 file 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 ----------------------