summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-04-28 04:29:06 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-04-28 04:29:06 +0000
commite07a457c0054fa20dcbbf5bf41bc07191bdaa895 (patch)
treed4456a807e2a8b66b66b1f6c0de6ad9df3b65734 /tests
parenta1e4b15f15d7807ddd35c0172b738a6e399235f6 (diff)
Fixed #7096 -- The simplifications in [7461] weren't complete. They broke
multi-component exclude() calls. Fixed that. git-svn-id: http://code.djangoproject.com/svn/django/trunk@7493 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/queries/models.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/regressiontests/queries/models.py b/tests/regressiontests/queries/models.py
index 5529bced8b..e108c46352 100644
--- a/tests/regressiontests/queries/models.py
+++ b/tests/regressiontests/queries/models.py
@@ -658,5 +658,24 @@ Bug #7098 -- Make sure semi-deprecated ordering by related models syntax still
works.
>>> Item.objects.values('note__note').order_by('queries_note.note', 'id')
[{'note__note': u'n2'}, {'note__note': u'n3'}, {'note__note': u'n3'}, {'note__note': u'n3'}]
+
+Bug #7096 -- Make sure exclude() with multiple conditions continues to work.
+>>> Tag.objects.filter(parent=t1, name='t3').order_by('name')
+[<Tag: t3>]
+>>> Tag.objects.exclude(parent=t1, name='t3').order_by('name')
+[<Tag: t1>, <Tag: t2>, <Tag: t4>, <Tag: t5>]
+>>> Item.objects.exclude(tags__name='t1', name='one').order_by('name').distinct()
+[<Item: four>, <Item: three>, <Item: two>]
+>>> Item.objects.filter(name__in=['three', 'four']).exclude(tags__name='t1').order_by('name')
+[<Item: four>, <Item: three>]
+
+More twisted cases, involving nested negations.
+>>> Item.objects.exclude(~Q(tags__name='t1', name='one'))
+[<Item: one>]
+>>> Item.objects.filter(~Q(tags__name='t1', name='one'), name='two')
+[<Item: two>]
+>>> Item.objects.exclude(~Q(tags__name='t1', name='one'), name='two')
+[<Item: four>, <Item: one>, <Item: three>]
+
"""}