Ticket #10298: docs-shortcuts.diff

File docs-shortcuts.diff, 476 bytes (added by Masklinn, 16 years ago)

Call to list(), to make the returned queryset into one

  • docs/topics/http/shortcuts.txt

     
    148148    from django.http import Http404
    149149
    150150    def my_view(request):
    151         my_objects = MyModel.objects.filter(published=True)
     151        my_objects = list(MyModel.objects.filter(published=True))
    152152        if not my_objects:
    153153            raise Http404
Back to Top