Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有显示可以按城市过滤的事件的列表页面,我也在使用 Django 分页器。我的问题是如何在另一个页面上保留过滤器?
示例 view.py 不是实际代码..
event_list = Event.objects.filter(city=something) paginator = Paginator(event_list, 1) # Show 25 contacts per page
您需要手动传递额外的 get 变量,这些变量稍后将用于过滤:
<a href="?page={{ paginator.next_page_number }}&my_filter_a={{ my_filter_a }}&my_filter_b={{ my_filter_b }}">Next</a>