diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2009-01-05 11:47:48 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2009-01-05 11:47:48 +0000 |
| commit | f747b61c20cb2ab9bcbca2b272f3fba80cf39ac6 (patch) | |
| tree | fd654b89d7a1a492b590e0e34530e45ba837cf39 /tests/regressiontests | |
| parent | 062a94ef45e71f525de1c9095aeb3f376feb8232 (diff) | |
Nested query support.
This extends previous functionality that allowed passing Query objects as the
rvals to filters. You can now pass QuerySets, which requires less poking at
opaque attributes. See the documentation of the "__in" lookup type for the
details.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9701 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests')
| -rw-r--r-- | tests/regressiontests/queries/models.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/regressiontests/queries/models.py b/tests/regressiontests/queries/models.py index 94f2045fe7..a3247bb460 100644 --- a/tests/regressiontests/queries/models.py +++ b/tests/regressiontests/queries/models.py @@ -1008,6 +1008,13 @@ cases). # optimise the inner query without losing results. >>> Annotation.objects.exclude(tag__children__name="t2") [<Annotation: a2>] + +Nested queries are possible (although should be used with care, since they have +performance problems on backends like MySQL. + +>>> Annotation.objects.filter(notes__in=Note.objects.filter(note="n1")) +[<Annotation: a1>] + """} # In Python 2.3 and the Python 2.6 beta releases, exceptions raised in __len__ |
