-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
clarify the signature of the choice_value callable #6297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree that it would be best to have the section overhauled in general, but I also agree that this is a nice short-term fix. However, I suggest to change this a bit to something like this: .. note::
In contrast to the ``choice_label`` and ``choice_name`` option when using
a callable for the ``choice_value`` option, the actual choice is the **only**
argument passed to it. What do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 This is a detail but I would say : .. 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. Because the actual enumeration misses Anyway please remove |
||
|
||
.. caution:: | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's better to remove
"See
choice_label_ for similar usage.
completely. This would avoid talking about "differences" with the other options.