1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

[soc2009/model-validation] Merged to trunk at r10941

git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10944 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Honza Král
2009-06-08 00:54:28 +00:00
parent 7b14625d0d
commit 3e625f2667
6 changed files with 188 additions and 7 deletions

View File

@@ -1143,6 +1143,36 @@ True
>>> r.save()
>>> Ranking.objects.all()
[<Ranking: 3: a1>, <Ranking: 2: a2>, <Ranking: 1: a3>]
# Regression test for #10742:
# Queries used in an __in clause don't execute subqueries
>>> subq = Author.objects.filter(num__lt=3000)
>>> qs = Author.objects.filter(pk__in=subq)
>>> list(qs)
[<Author: a1>, <Author: a2>]
# The subquery result cache should not be populated
>>> subq._result_cache is None
True
>>> subq = Author.objects.filter(num__lt=3000)
>>> qs = Author.objects.exclude(pk__in=subq)
>>> list(qs)
[<Author: a3>, <Author: a4>]
# The subquery result cache should not be populated
>>> subq._result_cache is None
True
>>> subq = Author.objects.filter(num__lt=3000)
>>> list(Author.objects.filter(Q(pk__in=subq) & Q(name='a1')))
[<Author: a1>]
# The subquery result cache should not be populated
>>> subq._result_cache is None
True
"""}
# In Python 2.3 and the Python 2.6 beta releases, exceptions raised in __len__