diff options
| author | Peter Inglesby <peter.inglesby@gmail.com> | 2014-10-27 20:21:59 +0000 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2014-11-04 11:23:58 -0500 |
| commit | 74e1980cf96eb45079bef464fabdcbe0a6db2423 (patch) | |
| tree | 0541e693623c87c9789f1beb37d7f5831426c74b /docs/ref | |
| parent | e0685368c6b122404cf0817d5cb17ab1b211cf6d (diff) | |
Fixed #13181 -- Added support for callable choices to forms.ChoiceField
Thanks vanschelven and expleo for the initial patch.
Diffstat (limited to 'docs/ref')
| -rw-r--r-- | docs/ref/forms/fields.txt | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/docs/ref/forms/fields.txt b/docs/ref/forms/fields.txt index d7fcef2e75..070ccdf7a8 100644 --- a/docs/ref/forms/fields.txt +++ b/docs/ref/forms/fields.txt @@ -387,10 +387,16 @@ For each field, we describe the default widget used if you don't specify .. attribute:: choices - An iterable (e.g., a list or tuple) of 2-tuples to use as choices for this - field. This argument accepts the same formats as the ``choices`` argument - to a model field. See the :ref:`model field reference documentation on - choices <field-choices>` for more details. + Either an iterable (e.g., a list or tuple) of 2-tuples to use as + choices for this field, or a callable that returns such an iterable. + This argument accepts the same formats as the ``choices`` argument to a + model field. See the :ref:`model field reference documentation on + choices <field-choices>` for more details. If the argument is a + callable, it is evaluated each time the field's form is initialized. + + .. versionchanged:: 1.8 + + The ability to pass a callable to ``choices`` was added. ``TypedChoiceField`` ~~~~~~~~~~~~~~~~~~~~ |
