[Answer]-Django ListView pagination using Form

1👍

You need to overide get_context_data in your BlogSearchView.

Fast solution:

class BlogSearchView(ListView):

    def get_queryset():
        ...
        #Your queryset definition
        self.search_term = search_term
        self.form = form
        return qset

    def get_context_data(self, **kwargs):
        context = super(BlogSearchView, self).get_context_data(**kwargs)
        context['search_term'] = self.search_term
        context['form'] = self.form
        return context

And then you can use search_term and form in template.

Leave a comment