Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #5166 -- Fixed a validation problem in one of the examples. Tha…

…nks, o.ekanem@gmail.com.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@5930 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 24081d995962d14388bf98c1c572603ffd1beeb6 1 parent 04c77db
Malcolm Tredinnick authored

Showing 1 changed file with 2 additions and 2 deletions. Show diff stats Hide diff stats

  1. 4  docs/newforms.txt
4  docs/newforms.txt
@@ -1419,12 +1419,12 @@ keep it simple and assume e-mail validation is contained in a function called
1419 1419
 
1420 1420
     class MultiEmailField(forms.Field):
1421 1421
         def clean(self, value):
  1422
+            if not value:
  1423
+                raise forms.ValidationError('Enter at least one e-mail address.')
1422 1424
             emails = value.split(',')
1423 1425
             for email in emails:
1424 1426
                 if not is_valid_email(email):
1425 1427
                     raise forms.ValidationError('%s is not a valid e-mail address.' % email)
1426  
-            if not emails:
1427  
-                raise forms.ValidationError('Enter at least one e-mail address.')
1428 1428
             return emails
1429 1429
 
1430 1430
 Let's alter the ongoing ``ContactForm`` example to demonstrate how you'd use

0 notes on commit 24081d9

Please sign in to comment.
Something went wrong with that request. Please try again.