How to handle request.GET with multiple variables for the same parameter in Django

时光怂恿深爱的人放手 提交于 2019-11-27 00:39:34
AndrewF

You want the getlist() function of the GET object:

request.GET.getlist('myvar')

Another solution is creating a copy of the request object... Normally, you can not iterate through a request.GET or request.POST object, but you can do such operations on the copy:

res_set = request.GET.copy()
for item in res_set['myvar']:
    item
...
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!