From b102c27ff4d21ea6262e600227530f75337a5df2 Mon Sep 17 00:00:00 2001 From: Si Feng Date: Sun, 21 Jul 2013 17:27:56 -0700 Subject: Fixed #20784 -- Added inverse_match parameter to RegexValidator. --- docs/ref/validators.txt | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'docs/ref') 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]) -- cgit v1.3