Weird database issue in django
I have a st开发者_JAVA技巧range database problem in django, using sqlite:
In the Model "PrivateMessage":
[..]
deleted_from = models.BooleanField(default=False)
[..]
In ./manage.py shell
In [8]: PrivateMessage.objects.filter(deleted_from=False)
Out[8]: []
In [9]: PrivateMessage.objects.filter(deleted_from=True)
Out[9]: []
In [10]: PrivateMessage.objects.get(id=9).deleted_from
Out[10]: False
I could only imagine, that the database is corrupt. Any other ideas?
It's a bug with south and sqlite: http://south.aeracode.org/ticket/600
Maybe it is some sqlite specific problem, but actually I don't know. Just some idea's what I would do.
You could take a look at the actual SQL query and check if it is correct:
# print PrivateMessage.objects.filter(deleted_from=False).query
Check what's the values and types of the deleted_from
model field:
# [(m.deleted_from, type(m.deleted_from)) for m in PrivateMessage.objects.all()]
精彩评论