Skip to content

Commit

Permalink
Update documentation for DomainNameValidator.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nina Menezes committed Apr 20, 2024
1 parent d62d7a9 commit f77f5f3
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
37 changes: 37 additions & 0 deletions docs/ref/validators.txt
Original file line number Diff line number Diff line change
Expand Up @@ -370,3 +370,40 @@ to, or in lieu of custom ``field.clean()`` methods.
.. versionchanged:: 5.0

The ``offset`` argument was added.


``DomainNameValidator``
----------------

.. class:: DomainNameValidator(schemes=None, regex=None, message=None, code=None, is_idna=)

A :class:`RegexValidator` subclass that ensures a value looks like a domain name. Values longer than
255 characters are always considered invalid.

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


.. attribute:: is_idna
This determines whether or not to accept internationalized domain name, that is,
domain names that contain non-ASCII characters. Default value is true.


.. versionadded:: 5.1


``validate_domain_name``
------------------

.. data:: validate_domain_name

An :class:`DomainNameValidator` instance without any customizations.



``validate_email``
------------------

.. data:: validate_email

An :class:`EmailValidator` instance without any customizations.
2 changes: 2 additions & 0 deletions docs/releases/5.1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,8 @@ Utilities

Validators
~~~~~~~~~~
* The new :class:`~django.core.validators.DomainNameValidator` validates domain
names, including internationalized domain names.

* ...

Expand Down

0 comments on commit f77f5f3

Please sign in to comment.