How to pass the dictionary from redirect in django in python using POST method?
I am trying to redirect to a new html page in my django app from view and I also want to pass a dictionary by POST method . For this I have written the code as -
return redirect('/fun_generated/',{'val0':val0})
But when I am trying to access the dictionary from the function as -
def fun_generated(request):
By using request.POST.get('val0') it is showing none.
I have tried the kwargs as -
doc = {'val0':val0}
return redirect('/fun_generated',kwargs={'val0':val0})
and then access in the function as -
def fun_generated(request, **kwargs):
It is still not working
I have also tried to use the url method as -
encoded_string=urllib.parse.urlencode(doc) return redirect(f'/fun_generated?%s'%encoded_string)
but this is using the GET method also when I am trying to access by using this GET method as -
request.GET.get('reason_data')
It is giving the data as ['vaue']. I don't know where these [] come from and how can I pass using POST method?