Kaydet (Commit) 24081d99 authored tarafından Malcolm Tredinnick's avatar Malcolm Tredinnick

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
üst 04c77db2
...@@ -1419,12 +1419,12 @@ keep it simple and assume e-mail validation is contained in a function called ...@@ -1419,12 +1419,12 @@ keep it simple and assume e-mail validation is contained in a function called
class MultiEmailField(forms.Field): class MultiEmailField(forms.Field):
def clean(self, value): def clean(self, value):
if not value:
raise forms.ValidationError('Enter at least one e-mail address.')
emails = value.split(',') emails = value.split(',')
for email in emails: for email in emails:
if not is_valid_email(email): if not is_valid_email(email):
raise forms.ValidationError('%s is not a valid e-mail address.' % 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 return emails
Let's alter the ongoing ``ContactForm`` example to demonstrate how you'd use Let's alter the ongoing ``ContactForm`` example to demonstrate how you'd use
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment