From 222cac43ca8fe3ce3ba68a3b28cc558887aeecc2 Mon Sep 17 00:00:00 2001 From: Oliver Hoff Date: Mon, 22 Feb 2016 21:12:09 +0100 Subject: [PATCH 1/3] clarify the signature of the choice_value callable --- reference/forms/types/options/choice_value.rst.inc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/reference/forms/types/options/choice_value.rst.inc b/reference/forms/types/options/choice_value.rst.inc index fda5a4e7542..928aee57474 100644 --- a/reference/forms/types/options/choice_value.rst.inc +++ b/reference/forms/types/options/choice_value.rst.inc @@ -12,7 +12,10 @@ about this, but it might be handy when processing an API request (since you can configure the value that will be sent in the API request). This can be a callable or a property path. See `choice_label`_ for similar usage. -If ``null`` is used, an incrementing integer is used as the name. +*If you use a callable for this option, it gets passed the choice as its **only** +argument*. This is a difference compared to the callables of `choice_label`_ and +`choice_name`_, which receive additional arguments. If ``null`` is used, an +incrementing integer is used as the name. .. caution:: From b3b20df0e53ab92de69de7b67084010e84ba17cb Mon Sep 17 00:00:00 2001 From: Oliver Hoff Date: Tue, 23 Feb 2016 22:14:53 +0100 Subject: [PATCH 2/3] fixup! clarify the signature of the choice_value callable --- reference/forms/types/options/choice_value.rst.inc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/reference/forms/types/options/choice_value.rst.inc b/reference/forms/types/options/choice_value.rst.inc index 928aee57474..30b716c1909 100644 --- a/reference/forms/types/options/choice_value.rst.inc +++ b/reference/forms/types/options/choice_value.rst.inc @@ -11,11 +11,14 @@ in HTML and submitted in the POST/PUT requests. You don't normally need to worry about this, but it might be handy when processing an API request (since you can configure the value that will be sent in the API request). -This can be a callable or a property path. See `choice_label`_ for similar usage. -*If you use a callable for this option, it gets passed the choice as its **only** -argument*. This is a difference compared to the callables of `choice_label`_ and -`choice_name`_, which receive additional arguments. If ``null`` is used, an -incrementing integer is used as the name. +This can be a callable or a property path. If ``null`` is given, an incrementing +integer is used as the value. + +.. note:: + + In contrast to other choice options (e.g. `choice_label`_), the callable for + the ``choice_value`` option takes as **only** argument the actual choice, which + is also the value that gets passed to your model after submitting the form. .. caution:: From fc01a7057887d5a68b3803a0cb2754d15cb3eb20 Mon Sep 17 00:00:00 2001 From: Oliver Hoff Date: Tue, 23 Feb 2016 22:34:54 +0100 Subject: [PATCH 3/3] fixup! clarify the signature of the choice_value callable --- reference/forms/types/options/choice_value.rst.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/forms/types/options/choice_value.rst.inc b/reference/forms/types/options/choice_value.rst.inc index 30b716c1909..4351a9f4f21 100644 --- a/reference/forms/types/options/choice_value.rst.inc +++ b/reference/forms/types/options/choice_value.rst.inc @@ -18,7 +18,7 @@ integer is used as the value. In contrast to other choice options (e.g. `choice_label`_), the callable for the ``choice_value`` option takes as **only** argument the actual choice, which - is also the value that gets passed to your model after submitting the form. + is also the value that gets passed to your model when submitting the form. .. caution::