diff options
| author | areski <areski@gmail.com> | 2014-08-13 16:59:58 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2014-08-14 13:28:12 -0400 |
| commit | 2a4492aecb50122f7cc2c643f7ea5b086f301165 (patch) | |
| tree | d5134268ec053f4da85e62464ecd828a40aabf7f /docs/ref/validators.txt | |
| parent | bef5b9b7cdca04713ab5a34fa02b2e8dfcf79d9e (diff) | |
Fixed #23224 - Documented EmailValidator.
Diffstat (limited to 'docs/ref/validators.txt')
| -rw-r--r-- | docs/ref/validators.txt | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/docs/ref/validators.txt b/docs/ref/validators.txt index daa35862c0..42fb44b650 100644 --- a/docs/ref/validators.txt +++ b/docs/ref/validators.txt @@ -105,6 +105,35 @@ to, or in lieu of custom ``field.clean()`` methods. :exc:`TypeError` is raised. Defaults to `0`. +``EmailValidator`` +------------------ + +.. class:: EmailValidator([message=None, code=None, whitelist=None]) + + :param message: If not ``None``, overrides :attr:`.message`. + :param code: If not ``None``, overrides :attr:`code`. + :param whitelist: If not ``None``, overrides :attr:`whitelist`. + + .. attribute:: message + + The error message used by + :exc:`~django.core.exceptions.ValidationError` if validation fails. + Defaults to ``"Enter a valid email address"``. + + .. attribute:: code + + The error code used by :exc:`~django.core.exceptions.ValidationError` + if validation fails. Defaults to ``"invalid"``. + + .. attribute:: 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. + ``URLValidator`` ---------------- .. class:: URLValidator([schemes=None, regex=None, message=None, code=None]) @@ -130,8 +159,7 @@ to, or in lieu of custom ``field.clean()`` methods. ------------------ .. data:: validate_email - An ``EmailValidator`` instance that ensures a value looks like an - email address. + An :class:`EmailValidator` instance without any customizations. ``validate_slug`` ----------------- |
