python - Django分页和查询参数的问题
天蓬老师
天蓬老师 2017-04-18 10:32:03
0
1
581

查询是通过get的方式,之前没有分页之前,url是这样的:

http://hostname/search?query=port%3A8080

那么我的想法是如果分页了。

1,不带page参数了。next之后就加载下一页的内容

http://hostname/search?query=port%3A8080

请问这个是通过post传参吗?

2,
使用官方文档中的(目前的方案)

    http://hostname/search?query=port%3A8080?page=2

但是,在现实情况下。?page=2 就替代了?query=port%3A8080 变成了这样:

http://hostname/search?page=2

请问这这种情况怎么处理?
urls.py

    url(r'^search$', views.show_results, name='results'),

谢谢

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(1)
Peter_Zhu

Sorry, I didn’t quite understand the question...
"1, without the page parameter. After next, the content of the next page will be loaded."
Doesn’t page mean which page of data is to be queried? For example, you have opened page 1 now, click next, and request the parameter page=2 from the backend. So, this page is a must-have. Otherwise, how does the backend know which page the next page is?
In addition, if there are multiple parameters, then multiple parameter pairs need to be connected with & instead of? . Only the first parameter is in front? Connect with URL. Is there a "clerical error" in the URL in your question?
Backend url matching is based on regular matching,? The latter part will be ignored when matching the URL.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!