kmpekala / django-forum

Automatically exported from code.google.com/p/django-forum
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

NullBooleanField and BooleanField #65

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. use latest svn version of Django and django-forum
2. run manage.py syncdb

What is the expected output? What do you see instead?
Error: One or more models did not validate:
forum.thread: "sticky": BooleanFields do not accept null values. Use a
NullBooleanField instead.
forum.thread: "closed": BooleanFields do not accept null values. Use a
NullBooleanField instead.

What version of the product are you using? On what operating system?
latest svn version of django-forum (rev 45)
latest svn version of django (rev 10665)

Please provide any additional information below.
simple solution:

models.py:

try: 
   from django.db.models import NullBooleanField 
except ImportError: 
   from django.db.models import BooleanField as NullBooleanField

Original issue reported on code.google.com by mikaelmo...@gmail.com on 3 May 2009 at 12:48

GoogleCodeExporter commented 8 years ago
Issue 67 has been merged into this issue.

Original comment by rwpoul...@gmail.com on 4 Aug 2009 at 12:29

GoogleCodeExporter commented 8 years ago
I have fixed this by removing the null=True from the BooleanFields and forcing 
the
default to False.

I would suggest updating all existing records with this SQL query:

UPDATE forum_thread SET sticky='f' WHERE sticky='';
UPDATE forum_thread SET closed='f' WHERE closed='';

Change is in SVN r46.

Original comment by rwpoul...@gmail.com on 4 Aug 2009 at 12:33