I have a Django view with pagination:
class MyListView(ListView):
model = Model
context_object_name = "Model"
template_name = "template.html"
paginate_by = 6
This template has a search bar that works fine:
def get_queryset(self):
if query:
postresult = account_list.filter(name__contains=query)
list = postresult
return list
The problem is, I want the pagination value for a page with a search query to be 20. How can I make the paginate_by value a conditional?