Fixed Q object ObjectId comparison issue

This commit is contained in:
Harry Marr
2010-02-26 17:13:19 +00:00
parent 0b1c506626
commit 6e77e32855
2 changed files with 14 additions and 4 deletions

View File

@@ -376,6 +376,11 @@ class QuerySetTest(unittest.TestCase):
post6 = BlogPost(published=False)
post6.save()
# Check ObjectId lookup works
obj = BlogPost.objects(id=post1.id).first()
self.assertEqual(obj, post1)
# Check Q object combination
date = datetime(2010, 1, 10)
q = BlogPost.objects(Q(publish_date__lte=date) | Q(published=True))
posts = [post.id for post in q]