Ticket #10947: 10947.diff

File 10947.diff, 647 bytes (added by timo, 6 years ago)
  • ref/models/querysets.txt

     
    12951295
    12961296        values = Blog.objects.filter(
    12971297                name__contains='Cheddar').values_list('pk', flat=True)
    1298         entries = Entry.objects.filter(blog__in=values)
     1298        entries = Entry.objects.filter(blog__in=list(values))
    12991299
     1300    Note the ``list()`` call around the Blog ``QuerySet`` to force execution of
     1301    the first query. Without it, a nested query would be executed since
     1302    :ref:`querysets-are-lazy`.
     1303
    13001304gt
    13011305~~
    13021306
Back to Top