vishavjeet

singh.vishavjeet11@gmail.com

request.POST["key"] returns only the last value of a list

Posted on May 06, 2021



print(request.POST) #{'key': ['a', 'b', 'c']}

print(request.POST["key"]) #c

print(dict(request.POST)["key"]) #['a', 'b', 'c']

values = request.POST.getlist('key')


Sign In for comment and like the post.