“Listenansicht rendern queryset” Code-Antworten

Listenansicht rendern queryset

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
WarlordOmar

Listenansicht rendern queryset

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
WarlordOmar

Ähnliche Antworten wie “Listenansicht rendern queryset”

Fragen ähnlich wie “Listenansicht rendern queryset”

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen