Opened 15 years ago

Closed 13 years ago

#10786 closed Cleanup/optimization (fixed)

Missing Documentation for new BooleanField limitation

Reported by: robingreen Owned by: sbj3
Component: Core (Other) Version: 1.0
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The recent add to django/trunk/django/core/management/validation.py breaks the Rietveld install process as described in:

http://code.google.com/appengine/articles/pure_django.html

Attachments (1)

fields-10786.diff (764 bytes ) - added by sbj3 14 years ago.
Added note to null attribute and BooleanField that NullBooleanField s/b used.

Download all attachments as: .zip

Change History (9)

comment:1 by robingreen, 15 years ago

Here's the error's output:

$ make all
svn co http://rietveld.googlecode.com/svn/trunk/codereview@405
A codereview/intra_region_diff.py
A codereview/middleware.py
A codereview/patching.py
A codereview/views.py
A codereview/init.py
A codereview/models.py
A codereview/library.py
A codereview/engine.py
A codereview/urls.py
A codereview/feeds.py

U codereview

Checked out revision 405.
patch -p0 < patches/library.diff
patching file codereview/library.py
patch -p0 < patches/views.diff
patching file codereview/views.py
patch -p0 < patches/models.diff
patching file codereview/models.py
./manage.py syncdb
Error: One or more models did not validate:
codereview.issue: "local_base": BooleanFields do not accept null values. Use a NullBooleanField instead.
codereview.issue: "closed": BooleanFields do not accept null values. Use a NullBooleanField instead.
codereview.message: "draft": BooleanFields do not accept null values. Use a NullBooleanField instead.
codereview.content: "is_uploaded": BooleanFields do not accept null values. Use a NullBooleanField instead.
codereview.content: "is_bad": BooleanFields do not accept null values. Use a NullBooleanField instead.
codereview.content: "file_too_large": BooleanFields do not accept null values. Use a NullBooleanField instead.
codereview.patch: "is_binary": BooleanFields do not accept null values. Use a NullBooleanField instead.
codereview.patch: "delta_calculated": BooleanFields do not accept null values. Use a NullBooleanField instead.
codereview.comment: "left": BooleanFields do not accept null values. Use a NullBooleanField instead.
codereview.account: "fresh": BooleanFields do not accept null values. Use a NullBooleanField instead.
codereview.account: "uploadpy_hint": BooleanFields do not accept null values. Use a NullBooleanField instead.

make: * [dev.db] Error 1

comment:2 by robingreen, 15 years ago

$ make all
svn co http://rietveld.googlecode.com/svn/trunk/codereview@405
A    codereview/intra_region_diff.py
A    codereview/middleware.py
A    codereview/patching.py
A    codereview/views.py
A    codereview/__init__.py
A    codereview/models.py
A    codereview/library.py
A    codereview/engine.py
A    codereview/urls.py
A    codereview/feeds.py
 U   codereview
Checked out revision 405.
patch -p0 < patches/library.diff
patching file codereview/library.py
patch -p0 < patches/views.diff
patching file codereview/views.py
patch -p0 < patches/models.diff
patching file codereview/models.py
./manage.py syncdb
Error: One or more models did not validate:
codereview.issue: "local_base": BooleanFields do not accept null values. Use a NullBooleanField instead.
codereview.issue: "closed": BooleanFields do not accept null values. Use a NullBooleanField instead.
codereview.message: "draft": BooleanFields do not accept null values. Use a NullBooleanField instead.
codereview.content: "is_uploaded": BooleanFields do not accept null values. Use a NullBooleanField instead.
codereview.content: "is_bad": BooleanFields do not accept null values. Use a NullBooleanField instead.
codereview.content: "file_too_large": BooleanFields do not accept null values. Use a NullBooleanField instead.
codereview.patch: "is_binary": BooleanFields do not accept null values. Use a NullBooleanField instead.
codereview.patch: "delta_calculated": BooleanFields do not accept null values. Use a NullBooleanField instead.
codereview.comment: "left": BooleanFields do not accept null values. Use a NullBooleanField instead.
codereview.account: "fresh": BooleanFields do not accept null values. Use a NullBooleanField instead.
codereview.account: "uploadpy_hint": BooleanFields do not accept null values. Use a NullBooleanField instead.

make: *** [dev.db] Error 1

comment:3 by James Bennett, 15 years ago

Resolution: invalid
Status: newclosed

The error message makes clear what's going on here. BooleanField is only for two-value (true or false) logic. If three-value (true, false or null) logic is needed, use NullBooleanField.

[10456] corrected a bug wherein null=True was allowed on the field definition even though assigning a null value to the field would raise a (run-time) exception. The correct thing for any application which relied on the buggy behavior is simply to use a NullBooleanField instead.

comment:4 by yishai@…, 15 years ago

Needs documentation: set
Resolution: invalid
Status: closedreopened
Summary: "BooleanFields do not accept null values" breaks Rietveld local install.Missing Documentation for new BooleanField limitation

I am reopening - apologies if this is not the proper way to do this. This change is not documented in the Model field documentation nor in the backwards incompatible changes list (e.g., in the release notes or in the Wiki).

See in particular the (now) misleading text in:
http://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.Field.null
And no mention of this limitation in:
http://docs.djangoproject.com/en/dev/ref/models/fields/#booleanfield

comment:5 by Alex Gaynor, 15 years ago

Triage Stage: UnreviewedAccepted

This should be in the 1.1 release document.

by sbj3, 14 years ago

Attachment: fields-10786.diff added

Added note to null attribute and BooleanField that NullBooleanField s/b used.

comment:6 by sbj3, 14 years ago

Has patch: set
Needs documentation: unset
Owner: changed from nobody to sbj3
Status: reopenednew

comment:7 by Chris Beaven, 13 years ago

Severity: Normal
Type: Cleanup/optimization

comment:8 by Chris Beaven, 13 years ago

Resolution: fixed
Status: newclosed

In [16020]:

Fixes #10786 -- Document that NullBooleanField should be used rather than BooleanField with null=True. Thanks sbj3 for the patch.

Note: See TracTickets for help on using tickets.
Back to Top