diff options
| author | Tim Graham <timograham@gmail.com> | 2017-05-06 10:56:28 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2018-03-20 12:10:10 -0400 |
| commit | 5fa4f40f45fcdbb7e48489ed3039a314b5c961d0 (patch) | |
| tree | 272b8798d2c2a054f56d8613a42453bce30f92c0 /docs/ref/models | |
| parent | 73f7d1755ff1da3aac687c7b046e4b5028e505db (diff) | |
Fixed #29227 -- Allowed BooleanField to be null=True.
Thanks Lynn Cyrin for contributing to the patch, and Nick Pope for review.
Diffstat (limited to 'docs/ref/models')
| -rw-r--r-- | docs/ref/models/fields.txt | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt index afd0d6ff0c..adb12aac63 100644 --- a/docs/ref/models/fields.txt +++ b/docs/ref/models/fields.txt @@ -61,9 +61,6 @@ set ``blank=True`` if you wish to permit empty values in forms, as the When using the Oracle database backend, the value ``NULL`` will be stored to denote the empty string regardless of this attribute. -If you want to accept :attr:`~Field.null` values with :class:`BooleanField`, -use :class:`NullBooleanField` instead. - ``blank`` --------- @@ -442,15 +439,18 @@ case it can't be included in a :class:`~django.forms.ModelForm`. A true/false field. -The default form widget for this field is a -:class:`~django.forms.CheckboxInput`. - -If you need to accept :attr:`~Field.null` values then use -:class:`NullBooleanField` instead. +The default form widget for this field is :class:`~django.forms.CheckboxInput`, +or :class:`~django.forms.NullBooleanSelect` if :attr:`null=True <Field.null>`. The default value of ``BooleanField`` is ``None`` when :attr:`Field.default` isn't defined. +.. versionchanged:: 2.1 + + In older versions, this field doesn't permit ``null=True``, so you have to + use :class:`NullBooleanField` instead. Using the latter is now discouraged + as it's likely to be deprecated in a future version of Django. + ``CharField`` ------------- @@ -1008,9 +1008,8 @@ values are stored as null. .. class:: NullBooleanField(**options) -Like a :class:`BooleanField`, but allows ``NULL`` as one of the options. Use -this instead of a :class:`BooleanField` with ``null=True``. The default form -widget for this field is a :class:`~django.forms.NullBooleanSelect`. +Like :class:`BooleanField` with ``null=True``. Use that instead of this field +as it's likely to be deprecated in a future version of Django. ``PositiveIntegerField`` ------------------------ |
