From 4a1f2129d09658e705fbe0660275c6efccf1474a Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Sun, 5 Dec 2010 04:47:19 +0000 Subject: Fixed #12398 -- Added a TypedMultipleChoiceField. Thanks to Tai Lee. git-svn-id: http://code.djangoproject.com/svn/django/trunk@14829 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- docs/ref/forms/fields.txt | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'docs/ref/forms') diff --git a/docs/ref/forms/fields.txt b/docs/ref/forms/fields.txt index 7f18c673b6..b36c9cc749 100644 --- a/docs/ref/forms/fields.txt +++ b/docs/ref/forms/fields.txt @@ -361,13 +361,14 @@ Takes one extra required argument: .. class:: TypedChoiceField(**kwargs) -Just like a :class:`ChoiceField`, except :class:`TypedChoiceField` takes an -extra ``coerce`` argument. +Just like a :class:`ChoiceField`, except :class:`TypedChoiceField` takes two +extra arguments, ``coerce`` and ``empty_value``. * Default widget: ``Select`` * Empty value: Whatever you've given as ``empty_value`` - * Normalizes to: the value returned by the ``coerce`` argument. - * Validates that the given value exists in the list of choices. + * Normalizes to: A value of the type provided by the ``coerce`` argument. + * Validates that the given value exists in the list of choices and can be + coerced. * Error message keys: ``required``, ``invalid_choice`` Takes extra arguments: @@ -635,7 +636,25 @@ Takes two optional arguments for validation: of choices. * Error message keys: ``required``, ``invalid_choice``, ``invalid_list`` -Takes one extra argument, ``choices``, as for ``ChoiceField``. +Takes one extra required argument, ``choices``, as for ``ChoiceField``. + +``TypedMultipleChoiceField`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. class:: TypedMultipleChoiceField(**kwargs) + +Just like a :class:`MultipleChoiceField`, except :class:`TypedMultipleChoiceField` +takes two extra arguments, ``coerce`` and ``empty_value``. + + * Default widget: ``SelectMultiple`` + * Empty value: Whatever you've given as ``empty_value`` + * Normalizes to: A list of values of the type provided by the ``coerce`` + argument. + * Validates that the given values exists in the list of choices and can be + coerced. + * Error message keys: ``required``, ``invalid_choice`` + +Takes two extra arguments, ``coerce`` and ``empty_value``, as for ``TypedChoiceField``. ``NullBooleanField`` ~~~~~~~~~~~~~~~~~~~~ -- cgit v1.3