Ticket #13341: 13341-regexvalidator.diff

File 13341-regexvalidator.diff, 1.2 KB (added by David Fischer, 15 years ago)

Improved RegexValidator documentation

  • docs/ref/validators.txt

     
    5959``RegexValidator``
    6060------------------
    6161
    62 .. class:: RegexValidator(regex=None, message=None, code=None)
     62.. class:: RegexValidator(regex, message=None, code=None)
    6363
    64 .. attribute:: regex=None
     64.. attribute:: regex
    6565
    66 The regular expression to search for the provided ``value``. Raises a
    67 ``ValidationError`` if no match was found.
     66The regular expression pattern to search for the provided ``value``. Raises a
     67``ValidationError`` with ``message`` and ``code`` if no match is found.
    6868
    69 .. attribute:: code='invalid'
     69.. attribute:: message=None
    7070
    71 The error code to use if validation fails. Defaults to ``'invalid'``.
     71The error message used by ``ValidationError`` if validation fails. If no
     72``message`` is specified, a generic ``"Enter a valid value"`` message is used.
    7273
    73 .. attribute:: message=None
     74.. attribute:: code=None
    7475
    75 The error message to use if ``regex`` doesn't match the provided ``value``.
     76The error code used by ``ValidationError`` if validation fails. If ``code``
     77is not specified, ``"invalid"`` is used.
    7678
    7779``URLValidator``
    7880----------------
Back to Top