Reputation: 1864
I have a model field defined as follows:
class Room(models.Model):
...
...
is_course = models.BooleanField("Is Room a Course?", default= False)
Now, I'm trying to find all the records in my database that have a False value for the is_course field.
I try the following, but it doesn't seem to work:
myrooms = Room.objects.filter(is_course= False)
What is the correct way to do this/
Upvotes: 1
Views: 4080
Reputation: 2910
I see this problem too (same SQLite + Django 1.2 also). Must be some ORM bug. try running the following statement to fix it:
Room.objects.all().update(is_course=False)
after that, you should get results.
Upvotes: -2
Reputation: 48720
The query is correct. Make sure there are records in the database being queried. Do a Room.objects.all() and examine any for the is_course = to False.
Upvotes: 4