Issue
I have link looking like that:
<a class="page-link" href="{% url 'home-paginated' page_obj.next_page_number %}">Next</a>
and function getting params from current link:
function GetParams(){
const queryString = window.location.search;
console.log(queryString);
return queryString
}
and I'd like to set href value to connection of {% url 'home-paginated' page_obj.next_page_number %} and value returned by GetParams function (or just window.location.search)
for example let current link be
http://127.0.0.1:8000/2?sorted=normal
and after clicking "a" tag link should look like:
http://127.0.0.1:8000/3?sorted=normal
Solution
You can encode the querystring again with {{ request.GET.urlencode }}
:
<a class="page-link" href="{% url 'home-paginated' page_obj.next_page_number %}?{{ request.GET.urlencode }}">Next</a>
Answered By - Willem Van Onsem
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.