Django - Get query parameter list

后端 未结 4 1953
自闭症患者
自闭症患者 2020-12-29 10:14

I\'ve an endpoint

http://127.0.0.1:8000/auction/?status=[\'omn\',\'aad\']

I need to get the status list, hence I do the following

4条回答
  •  囚心锁ツ
    2020-12-29 10:27

    Don't send it in that format in the first place. The standard way of sending multiple values for a single HTML is to send the parameter multiple times:

    http://127.0.0.1:8000/auction/?status=omn&status=aad
    

    which will correctly give you ['omn','aad'] when you use request.GET.getlist('status').

提交回复
热议问题