diff options
| author | Jacob Walls <38668450+jacobtylerwalls@users.noreply.github.com> | 2020-10-08 06:39:02 -0400 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-10-08 12:39:54 +0200 |
| commit | 82bdc51e7afde3f17572f9c8e6fa805a692cd594 (patch) | |
| tree | b1a9cd744f782efd231a73e1d528120200368fc7 /docs | |
| parent | 1f8dbc8fa9f4c961a2b28fd03fd4892f379e929c (diff) | |
[3.1.x] Fixed #23681, Fixed #27445 -- Doc'd setting choices for NullBooleanField widgets.
Thanks to David Smith for investigation and review.
Co-authored-by: Carlton Gibson <carlton.gibson@noumenal.es>
Backport of d976c254fc76e5f04d81dfd9d142c58e933c9c92 from master
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/forms/fields.txt | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/docs/ref/forms/fields.txt b/docs/ref/forms/fields.txt index e43865ad4a..0bcf07ff08 100644 --- a/docs/ref/forms/fields.txt +++ b/docs/ref/forms/fields.txt @@ -913,6 +913,20 @@ For each field, we describe the default widget used if you don't specify * Normalizes to: A Python ``True``, ``False`` or ``None`` value. * Validates nothing (i.e., it never raises a ``ValidationError``). + ``NullBooleanField`` may be used with widgets such as + :class:`~django.forms.Select` or :class:`~django.forms.RadioSelect` + by providing the widget ``choices``:: + + NullBooleanField( + widget=Select( + choices=[ + ('', 'Unknown'), + (True, 'Yes'), + (False, 'No'), + ] + ) + ) + ``RegexField`` -------------- |
