core.validators.EmailValidator

class EmailValidator(message=None, code=None, whitelist=None) [source]

Parameters:
  • message – If not None, overrides message.
  • code – If not None, overrides code.
  • whitelist – If not None, overrides whitelist.
message

The error message used by ValidationError if validation fails. Defaults to "Enter a valid email address".

code

The error code used by ValidationError if validation fails. Defaults to "invalid".

whitelist

Whitelist of email domains to allow. By default, a regular expression (the domain_regex attribute) is used to validate whatever appears after the @ sign. However, if that string appears in the whitelist, this validation is bypassed. If not provided, the default whitelist is ['localhost']. Other domains that don’t contain a dot won’t pass validation, so you’d need to whitelist them as necessary.

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

Please login to continue.