core.validators.URLValidator

class URLValidator(schemes=None, regex=None, message=None, code=None) [source]

A RegexValidator that ensures a value looks like a URL, and raises an error code of 'invalid' if it doesn’t.

Loopback addresses and reserved IP spaces are considered valid. Literal IPv6 addresses (RFC 2732) and unicode domains are both supported.

In addition to the optional arguments of its parent RegexValidator class, URLValidator accepts an extra optional attribute:

schemes

URL/URI scheme list to validate against. If not provided, the default list is ['http', 'https', 'ftp', 'ftps']. As a reference, the IANA website provides a full list of valid URI schemes.

doc_Django
2016-10-09 18:35:03
Comments
Leave a Comment

Please login to continue.