Django:查询后,分页功能为全部对象分页,丢失查询查询参数
问题:
原始的链接为
http://127.0.0.1:8000/article/list-article-titles-bysomeone/guchen/?column=django
有一个column参数,单击下一页时,链接会变成
http://127.0.0.1:8000/article/list-article-titles-bysomeone/guchen/?page=2
会将column参数丢失,导致单击下一页时会显示成所有的对象的分页
<div class="pagination"> <span class="step-links"> {% if page.has_previous %} <a href="?page={{ page.previous_page_number }}">上一页</a> {% endif %} <span class="current"> Page{{ page.number }} of {{ page.paginator.num_pages }} </span> {% if page.has_next %} <a href="?page={{ page.next_page_number }}">下一页</a> {% endif %} </span> </div>
解决方案:
https://my.oschina.net/esdn/blog/836101
https://www.cnblogs.com/lgh344902118/p/6855683.html
https://blog.csdn.net/weixin_41812940/article/details/82707372