Ticket #3038: forms.patch

File forms.patch, 617 bytes (added by Thomas Steinacher <tom@…>, 18 years ago)

proposed patch

  • django/newforms/fields.py

     
    163163        Field.clean(self, value)
    164164        if value in EMPTY_VALUES: value = u''
    165165        value = smart_unicode(value)
    166         if not self.regex.search(value):
    167             raise ValidationError(self.error_message)
     166        if self.required or value:
     167            if not self.regex.search(value):
     168                raise ValidationError(self.error_message)
    168169        return value
    169170
    170171email_re = re.compile(
Back to Top