summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2013-03-24 13:47:01 +0100
committerAymeric Augustin <aymeric.augustin@m4x.org>2013-03-24 13:47:01 +0100
commite16c48e001ccd06830bb0bfd1d20e22ec30fce59 (patch)
tree3281a2007b0df0ad3653117dbd23a81acda5dea2 /docs
parentae417dd4d569669e8e1d8f15e643c6ba0820aafe (diff)
Fixed #15124 -- Changed the default for BooleanField.
Thanks to the many contributors who updated and improved the patch over the life of this ticket.
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/models/fields.txt4
-rw-r--r--docs/releases/1.6.txt14
2 files changed, 18 insertions, 0 deletions
diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt
index 421de74c62..f22436e5fe 100644
--- a/docs/ref/models/fields.txt
+++ b/docs/ref/models/fields.txt
@@ -377,6 +377,10 @@ The default form widget for this field is a
If you need to accept :attr:`~Field.null` values then use
:class:`NullBooleanField` instead.
+.. versionchanged:: 1.6
+ The default value of ``BooleanField`` was changed from ``False`` to
+ ``None`` when :attr:`Field.default` isn't defined.
+
``CharField``
-------------
diff --git a/docs/releases/1.6.txt b/docs/releases/1.6.txt
index db9c597490..f3d12cac38 100644
--- a/docs/releases/1.6.txt
+++ b/docs/releases/1.6.txt
@@ -292,6 +292,20 @@ should either restore Django's defaults at the end of each request, force an
appropriate value at the beginning of each request, or disable persistent
connections.
+``BooleanField`` no longer defaults to ``False``
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+When a :class:`~django.db.models.BooleanField` doesn't have an explicit
+:attr:`~django.db.models.Field.default`, the implicit default value is
+``None``. In previous version of Django, it was ``False``, but that didn't
+represent accurantely the lack of a value.
+
+Code that relies on the default value being ``False`` may raise an exception
+when saving new model instances to the database, because ``None`` isn't an
+acceptable value for a :class:`~django.db.models.BooleanField`. You should
+either specify ``default=False`` explicitly on the field definition, or ensure
+the field is set to ``True`` or ``False`` before saving the object.
+
Translations and comments in templates
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~