I use ListView to display the search result and use forms to enter user input values, this is the problem: when I get the search results, say 50 items, and I set item_per_page 30, so I got two pages, but now that I I click on the link to the next page, it forgets the previous search request and shows me all the elements on page 2, how to fix it? My code is below:
my form fields look like this:
<form method="get" action="{% url 'query_student' %}">
my page template:
{% if is_paginated %} <div class="pages"> {% if page_obj.has_previous %} <a href="/student/querystudent?page={{ page_obj.previous_page_number }}">previous</a> {% endif %} <span class="btnon"> page {{ page_obj.number }} total {{ page_obj.paginator.num_pages }} </span> {% if page_obj.has_next %} <a href="/student/querystudent?page={{ page_obj.next_page_number }}">>next</a> {% endif %} </div> {% endif %}
source share