summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-08-18 06:13:15 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-08-18 06:13:15 +0000
commit24081d995962d14388bf98c1c572603ffd1beeb6 (patch)
treefe57fde686ed3909d14eb9fb131cfa2e958e1d30 /docs
parent04c77db2c3c179b4d768c8809540768a81291457 (diff)
Fixed #5166 -- Fixed a validation problem in one of the examples. Thanks, o.ekanem@gmail.com.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5930 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
-rw-r--r--docs/newforms.txt4
1 files changed, 2 insertions, 2 deletions
diff --git a/docs/newforms.txt b/docs/newforms.txt
index 803dc6458a..b2dd1717a1 100644
--- a/docs/newforms.txt
+++ b/docs/newforms.txt
@@ -1419,12 +1419,12 @@ keep it simple and assume e-mail validation is contained in a function called
class MultiEmailField(forms.Field):
def clean(self, value):
+ if not value:
+ raise forms.ValidationError('Enter at least one e-mail address.')
emails = value.split(',')
for email in emails:
if not is_valid_email(email):
raise forms.ValidationError('%s is not a valid e-mail address.' % email)
- if not emails:
- raise forms.ValidationError('Enter at least one e-mail address.')
return emails
Let's alter the ongoing ``ContactForm`` example to demonstrate how you'd use