From 11cac1bd8ef7546ca32d9969d4348bf412dc6664 Mon Sep 17 00:00:00 2001 From: Curtis Date: Thu, 5 Feb 2015 23:26:15 +1100 Subject: Fixed #4960 -- Added "strip" option to CharField --- docs/ref/forms/fields.txt | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'docs/ref/forms') diff --git a/docs/ref/forms/fields.txt b/docs/ref/forms/fields.txt index dbade5c5d9..c4a40021d0 100644 --- a/docs/ref/forms/fields.txt +++ b/docs/ref/forms/fields.txt @@ -361,7 +361,7 @@ For each field, we describe the default widget used if you don't specify Otherwise, all inputs are valid. * Error message keys: ``required``, ``max_length``, ``min_length`` - Has two optional arguments for validation: + Has three optional arguments for validation: .. attribute:: max_length .. attribute:: min_length @@ -369,6 +369,13 @@ For each field, we describe the default widget used if you don't specify If provided, these arguments ensure that the string is at most or at least the given length. + .. attribute:: strip + + .. versionadded:: 1.9 + + If ``True`` (default), the value will be stripped of leading and + trailing whitespace. + ``ChoiceField`` ~~~~~~~~~~~~~~~ @@ -824,8 +831,15 @@ For each field, we describe the default widget used if you don't specify A regular expression specified either as a string or a compiled regular expression object. - Also takes ``max_length`` and ``min_length``, which work just as they do for - ``CharField``. + Also takes ``max_length``, ``min_length``, and ``strip``, which work just + as they do for ``CharField``. + + .. attribute:: strip + + .. versionadded:: 1.9 + + Defaults to ``False``. If enabled, stripping will be applied before the + regex validation. .. deprecated:: 1.8 -- cgit v1.3