多个get in django模板

嗨,我在一个页面中有多个分页。 可以说,我正在显示两个列表。 list1和list2。在视图中我使用django paginator对它们进行了分页,我获取了两个变量list1_page和list2_page。 现在我的模板看起来像这样
{{ list1_page_obj.object_list }}
{% if list1_page_obj.has_next %}
<a href='?list1_page={{ list1_page_obj.next_page_number }}'>NEXT</a>
{% endif %}

{{ list2_page_obj.object_list }}
{% if list2_page_obj.has_next %}
<a href='?list2_page={{ list1_page_obj.next_page_number }}'>NEXT</a>
{% endif %}
现在问题是如果我在list1的第二页上,我点击list2的NEXT页面,我得到列表2的下一页,但是显示了list1的第一页。 基本上如果我在http://foo.com/?list1_page=xx上,我点击list2上的NEXT,我得到了 http://foo.com/?list2_page=yy 我希望它重定向到http://foo.com/?list1_page=xx&list2_page=yy     
已邀请:
我想,你的分页功能有问题...我不知道你的分页功能变量名称,但可能你犯了错误;
next_page = int(request.GET.get('page', 1))
其中'page'是保存页面信息的变量,所以在你的代码中必须有两个paginator块,这两行分别包含在内......
lsit1_page = int(request.GET.get('list1_page', 1))
lsit2_page = int(request.GET.get('list2_page', 1))
    

要回复问题请先登录注册