list view render queryset

66

def get_context_data(self, **kwargs):
        context = super(BookListView, self).get_context_data(**kwargs)
        context['second_queryset'] = # YOUR QUERY HERE
        context['third_queryset'] = # YOUR QUERY HERE
        ...
        return context
class BookListView(generic.ListView):
    model = Book
    context_object_name = 'my_book_list'   
    queryset = Book.objects.all() 
    template_name = 'books/my_arbitrary_template_name_list.html'

    def get_context_data(self, **kwargs):
        context = super(BookListView, self).get_context_data(**kwargs)
        context['second_queryset'] = # YOUR QUERY HERE
        return context

Comments

Submit
0 Comments