Преглед на файлове

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>
Jacob Walls преди 4 години
родител
ревизия
d976c254fc
променени са 1 файла, в които са добавени 14 реда и са изтрити 0 реда
  1. 14 0
      docs/ref/forms/fields.txt

+ 14 - 0
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``
 --------------