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

前端 未结 2 829
Happy的楠姐
Happy的楠姐 2020-11-29 01:18

In a Django view you can access the request.GET[\'variablename\'], so in your view you can do something like this:

myvar = request.GET[\'myvar\'         


        
2条回答
  •  失恋的感觉
    2020-11-29 01:39

    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
    ...
    

提交回复
热议问题