Ticket #5166: 5166.patch

File 5166.patch, 815 bytes (added by Chris Beaven, 11 years ago)
  • docs/newforms.txt

     
    14191419
    14201420    class MultiEmailField(forms.Field):
    14211421        def clean(self, value):
     1422            if not value:
     1423                raise forms.ValidationError('Enter at least one e-mail address.')
    14221424            emails = value.split(',')
    14231425            for email in emails:
    14241426                if not is_valid_email(email):
    14251427                    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.')
    14281428            return emails
    14291429
    14301430Let's alter the ongoing ``ContactForm`` example to demonstrate how you'd use
Back to Top