Pagination in django - the original query string gets lost

前端 未结 4 876
慢半拍i
慢半拍i 2021-01-12 02:23

I use the code from the documentation to paginate the data:

try:
    data = paginator.page(request.GET.get(\'page\'))
except PageNotAnInteger:
    page = 1
          


        
4条回答
  •  春和景丽
    2021-01-12 02:50

    The easy way would be to include those variables in your template:

    next
    

    Just add var1 and var2 to your context.

    That's if the query string variables are originated from your backend. If they're coming from the front-end/external, you could use something like How can I get query string values in JavaScript? in your template and either edit the template vars directly or pass the values to your backend.

提交回复
热议问题