summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorSi Feng <si.feng@me.com>2013-07-21 17:27:56 -0700
committerTim Graham <timograham@gmail.com>2014-02-10 05:38:43 -0500
commitb102c27ff4d21ea6262e600227530f75337a5df2 (patch)
tree448783436b3dd1bcc27576d9cc1d7e5fbc3477a8 /docs
parent0d98422b1365ae1e75051036936aab31248d5ee1 (diff)
Fixed #20784 -- Added inverse_match parameter to RegexValidator.
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/validators.txt14
-rw-r--r--docs/releases/1.7.txt6
2 files changed, 17 insertions, 3 deletions
diff --git a/docs/ref/validators.txt b/docs/ref/validators.txt
index 1b706ab8e3..b3ae3c6d41 100644
--- a/docs/ref/validators.txt
+++ b/docs/ref/validators.txt
@@ -59,20 +59,22 @@ to, or in lieu of custom ``field.clean()`` methods.
``RegexValidator``
------------------
-.. class:: RegexValidator([regex=None, message=None, code=None])
+.. class:: RegexValidator([regex=None, message=None, code=None, inverse_match=None])
:param regex: If not ``None``, overrides :attr:`regex`. Can be a regular
expression string or a pre-compiled regular expression.
:param message: If not ``None``, overrides :attr:`.message`.
:param code: If not ``None``, overrides :attr:`code`.
+ :param inverse_match: If not ``None``, overrides :attr:`inverse_match`.
.. attribute:: regex
The regular expression pattern to search for the provided ``value``,
or a pre-compiled regular expression. Raises a
:exc:`~django.core.exceptions.ValidationError` with :attr:`message`
- and :attr:`code` if no match is found. By default, matches any string
- (including an empty string).
+ and :attr:`code` if :attr:`inverse_match` is ``False`` and a match is
+ found, or if :attr:`inverse_match` is ``True`` and a match is not found.
+ By default, matches any string (including an empty string).
.. attribute:: message
@@ -85,6 +87,12 @@ to, or in lieu of custom ``field.clean()`` methods.
The error code used by :exc:`~django.core.exceptions.ValidationError`
if validation fails. Defaults to ``"invalid"``.
+ .. attribute:: inverse_match
+
+ .. versionadded:: 1.7
+
+ The match mode for :attr:`regex`. Defaults to ``False``.
+
``URLValidator``
----------------
.. class:: URLValidator([schemes=None, regex=None, message=None, code=None])
diff --git a/docs/releases/1.7.txt b/docs/releases/1.7.txt
index 813e425f05..255cc35fa3 100644
--- a/docs/releases/1.7.txt
+++ b/docs/releases/1.7.txt
@@ -697,6 +697,12 @@ 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
+ be raised when the regular expression pattern matches (``True``) or does not
+ match (``False``, by default) the provided ``value``.
+
* :class:`~django.core.validators.URLValidator` now accepts an optional
``schemes`` argument which allows customization of the accepted URI schemes
(instead of the defaults ``http(s)`` and ``ftp(s)``).