Skip to content

Commit 3a478a2

Browse files
committed
minor #6297 clarify the signature of the choice_value callable (backbone87)
This PR was squashed before being merged into the 2.7 branch (closes #6297). Discussion ---------- clarify the signature of the choice_value callable | Q | A | | --- | --- | | Doc fix? | yes | | New docs? | no | | Applies to | 2.7+ | | Fixed tickets | | Commits ------- 5cf83f6 clarify the signature of the choice_value callable
2 parents 72a61ae + 5cf83f6 commit 3a478a2

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

reference/forms/types/options/choice_value.rst.inc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,14 @@ in HTML and submitted in the POST/PUT requests. You don't normally need to worry
1111
about this, but it might be handy when processing an API request (since you can
1212
configure the value that will be sent in the API request).
1313
14-
This can be a callable or a property path. See `choice_label`_ for similar usage.
15-
If ``null`` is used, an incrementing integer is used as the name.
14+
This can be a callable or a property path. If ``null`` is given, an incrementing
15+
integer is used as the value.
16+
17+
.. note::
18+
19+
In contrast to other choice options (e.g. `choice_label`_), the callable for
20+
the ``choice_value`` option takes as **only** argument the actual choice, which
21+
is also the value that gets passed to your model when submitting the form.
1622
1723
If you are using a callable to populate ``choice_value``, you need to check
1824
for the case that the value of the field may be ``null``.

0 commit comments

Comments
 (0)