def test_queryset_multiple(self):
"""
When using multiple paramters to filter they get ANDed together. Ensure
this works when filtering by QuerySet.
"""
qss = self._get_qss().filter(**{'#__gt': 0, 'title__gt': 'Django Rocks'})
data = [it.title for it in qss]
expected = [
# Some of the Articles and the BlogPosts.
'Some Article',
'Post',
]
self.assertEqual(data, expected)
# This would only look at Articles and BlogPosts, but neither of those
# have a title > "Some Article."
qss = self._get_qss().filter(**{'#__gt': 0, 'title__gt': 'Some Article'})
# Only the articles are here because it's the second queryset.
data = [it.title for it in qss]
self.assertEqual(data, [])
test_querysetsequence.py 文件源码
python
阅读 19
收藏 0
点赞 0
评论 0
评论列表
文章目录