mirror of
https://github.com/django/django.git
synced 2025-11-20 19:47:55 +00:00
Fixed #3038 -- newforms: RegexField no longer validates empty input for required=False. Thanks for reporting, Thomas Steinacher
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4111 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
d1757daf0f
commit
2e4ff8ee0c
2 changed files with 19 additions and 3 deletions
|
|
@ -170,7 +170,7 @@ class RegexField(Field):
|
|||
Field.clean(self, value)
|
||||
if value in EMPTY_VALUES: value = u''
|
||||
value = smart_unicode(value)
|
||||
if not self.regex.search(value):
|
||||
if (value or self.required) and not self.regex.search(value):
|
||||
raise ValidationError(self.error_message)
|
||||
return value
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue