summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-03-19 11:02:22 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-03-19 11:02:22 +0000
commitd20996b58dfde66d80d6728a70480c7e5caf7d48 (patch)
tree789b42361995d65aeaad8687a076855bcd24bc6b /tests
parentc0856978583af7aab22f08b97974a02e17cb5aad (diff)
queryset-refactor: Implemented a way to differentiate between filtering on a
single instance and filtering on multiple instances when spanning a multi-valued relationship. git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7317 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/queries/models.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/tests/regressiontests/queries/models.py b/tests/regressiontests/queries/models.py
index 08f55f4640..2db5bf8a34 100644
--- a/tests/regressiontests/queries/models.py
+++ b/tests/regressiontests/queries/models.py
@@ -210,11 +210,24 @@ True
>>> Item.objects.filter(Q(tags=t1)).order_by('name')
[<Item: one>, <Item: two>]
->>> Item.objects.filter(Q(tags=t1) & Q(tags=t2))
-[<Item: one>]
>>> Item.objects.filter(Q(tags=t1)).filter(Q(tags=t2))
[<Item: one>]
+Each filter call is processed "at once" against a single table, so this is
+different from the previous example as it tries to find tags that are two
+things at once (rather than two tags).
+>>> Item.objects.filter(Q(tags=t1) & Q(tags=t2))
+[]
+
+>>> qs = Author.objects.filter(ranking__rank=2, ranking__id=rank1.id)
+>>> list(qs)
+[<Author: a2>]
+>>> qs.query.count_active_tables()
+2
+>>> qs = Author.objects.filter(ranking__rank=2).filter(ranking__id=rank1.id)
+>>> qs.query.count_active_tables()
+3
+
Bug #4464
>>> Item.objects.filter(tags=t1).filter(tags=t2)
[<Item: one>]