Ticket #5166: 5166.patch
File 5166.patch, 815 bytes (added by , 17 years ago) |
---|
-
docs/newforms.txt
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