0

How to get the multiple value from request

@api_view(['POST', 'GET'])
def getParamAjax(request):
    print("{0}".format(request.query_params.get('genre')))

localhost/api/genre=test

it shows test, ....ok

localhost/api/genre=test&genre=cool

It shows only cool ....

Why multiple value is not obtained??

I want to get the value list like this below

genres = list(request.query_params.get("genre"))

And it doesn't work as Post.

Does anyone help???

whitebear
  • 11,200
  • 24
  • 114
  • 237

1 Answers1

0

I just use .getlist() instead of .get()

Thank you for the comment by John Gordon

whitebear
  • 11,200
  • 24
  • 114
  • 237