how to get multiple results using same query params django

旧时模样 提交于 2021-01-29 02:06:10

问题


Is there a way to get two results from using the same query params in django. I find the second value overwrites the first

For example:

http://localhost:8000/?id=3&id=4

the result returns the value with id=4 but i want result for id=3 and id=4


回答1:


What you want is the getlist() function of the QueryDict.

request.GET.getlist('myvar')


来源:https://stackoverflow.com/questions/42914751/how-to-get-multiple-results-using-same-query-params-django

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!