get_list_or_404()

get_list_or_404()

get_list_or_404() method

from django.shortcuts import get_list_or_404

def my_view(request):
    my_objects = get_list_or_404(MyModel, published=True)

Returns the result of filter() on a given model manager cast to a list, raising Http404 if the resulting list is empty.

get_list_or_404() — Structure map

Clickable & Draggable!

get_list_or_404() — Related pages: