Code

Ticket #10947: 10947.diff

File 10947.diff, 647 bytes (added by timo, 5 years ago)
Line 
1Index: ref/models/querysets.txt
2===================================================================
3--- ref/models/querysets.txt    (revision 11778)
4+++ ref/models/querysets.txt    (working copy)
5@@ -1295,8 +1295,12 @@
6 
7         values = Blog.objects.filter(
8                 name__contains='Cheddar').values_list('pk', flat=True)
9-        entries = Entry.objects.filter(blog__in=values)
10+        entries = Entry.objects.filter(blog__in=list(values))
11 
12+    Note the ``list()`` call around the Blog ``QuerySet`` to force execution of
13+    the first query. Without it, a nested query would be executed since
14+    :ref:`querysets-are-lazy`.
15+
16 gt
17 ~~
18