Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Fixed #3281 -- newforms: URLField now works properly with required=Fa…

…lse and verify_exists=True together. Thanks, zendak

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit f2a3deb0871c6cdbe04e1e0b36f4984c7c825bac 1 parent 6b31f95
@adrianholovaty adrianholovaty authored
2  django/newforms/
@@ -288,6 +288,8 @@ def __init__(self, max_length=None, min_length=None, required=True, verify_exist
def clean(self, value):
value = RegexField.clean(self, value)
+ if not self.required and value == u'':
+ return value
if self.verify_exists:
import urllib2
from django.conf import settings
5 tests/regressiontests/forms/
@@ -1331,6 +1331,11 @@
Traceback (most recent call last):
ValidationError: [u'This URL appears to be a broken link.']
+>>> f = URLField(verify_exists=True, required=False)
+>>> f.clean('')
+>>> f.clean('') # This will fail if there's no Internet connection
EmailField also access min_length and max_length parameters, for convenience.
>>> f = URLField(min_length=15, max_length=20)
Please sign in to comment.
Something went wrong with that request. Please try again.