mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Fixed #22255 -- Added support for specifying re flags in RegexValidator
This commit is contained in:
committed by
Erik Romijn
parent
f2eea960e0
commit
4d0c5f6142
@@ -795,11 +795,15 @@ Tests
|
||||
Validators
|
||||
^^^^^^^^^^
|
||||
|
||||
* :class:`~django.core.validators.RegexValidator` now accepts an optional
|
||||
Boolean :attr:`~django.core.validators.RegexValidator.inverse_match` argument
|
||||
which determines if the :exc:`~django.core.exceptions.ValidationError` should
|
||||
* :class:`~django.core.validators.RegexValidator` now accepts the optional
|
||||
:attr:`~django.core.validators.RegexValidator.flags` and
|
||||
Boolean :attr:`~django.core.validators.RegexValidator.inverse_match` arguments.
|
||||
The :attr:`~django.core.validators.RegexValidator.inverse_match` attribute
|
||||
determines if the :exc:`~django.core.exceptions.ValidationError` should
|
||||
be raised when the regular expression pattern matches (``True``) or does not
|
||||
match (``False``, by default) the provided ``value``.
|
||||
match (``False``, by default) the provided ``value``. The
|
||||
:attr:`~django.core.validators.RegexValidator.flags` attribute sets the flags
|
||||
used when compiling a regular expression string.
|
||||
|
||||
* :class:`~django.core.validators.URLValidator` now accepts an optional
|
||||
``schemes`` argument which allows customization of the accepted URI schemes
|
||||
@@ -1191,6 +1195,13 @@ Miscellaneous
|
||||
a relation from the related object back to the content type for filtering,
|
||||
ordering and other query operations.
|
||||
|
||||
* When a model field's :attr:`~django.db.models.Field.validators` contains
|
||||
a :class:`~django.core.validators.RegexValidator`, the regular expression
|
||||
must now be passed as a regular expression string. You can no longer use a
|
||||
pre-compiled regular expression in this case, as it is not serializable.
|
||||
The :attr:`~django.core.validators.RegexValidator.flags` attribute was added
|
||||
to :class:`~django.core.validators.RegexValidator` to simplify this change.
|
||||
|
||||
.. _deprecated-features-1.7:
|
||||
|
||||
Features deprecated in 1.7
|
||||
|
||||
Reference in New Issue
Block a user