Django搜索列表视图,具有多查询和分页功能。

问题描述 投票:0回答:1

我有这个问题https:/www.reddit.comrdjangocomments52vmygpagination_with_search但我需要列出多个搜索词,而不是将1个搜索词传递给我的分页链接。

例如

<a class="page-link" href="?status={{ request.GET.status }}&page={{ page_obj.next_page_number }}">Next</a>

工作正常,但我需要放入多个对象,害怕模板代码会变得不可读,有什么方法可以让我用通用的for循环访问request.GET项目吗?

或者也许有更好的方式来编写分页代码

python django listview search pagination
1个回答
0
投票

找到了,使用{{ request.get_full_path }}就能在我的模板中得到我需要的信息。

https:/docs.djangoproject.comen3.0refrequest-response。

© www.soinside.com 2019 - 2024. All rights reserved.