In my request.POST
i am getting a query dictionary , one of the items in this dictionary is a list with multiple items (pass_id
) eg.
I want to retrieve each of the values in pass_id
and store in a new list. Can you suggest the code for this?
Using Form in a View In Django, the request object passed as parameter to your view has an attribute called "method" where the type of the request is set, and all data passed via POST can be accessed via the request. POST dictionary. The view will display the result of the login form posted through the loggedin.
Django pass POST data to view The input fields defined inside the form pass the data to the redirected URL. You can define this URL in the urls.py file. In this URLs file, you can define the function created inside the view and access the POST data as explained in the above method. You just have to use the HTTPRequest.
Django puts data in request. POST when a user submits a form with the attribute method="post" . Line 10: You retrieve the submitted value by accessing the data at the key "follow" , which you defined in your template with the name HTML attribute on your <button> elements.
http://docs.djangoproject.com/en/dev/ref/request-response/#django.http.QueryDict.getlist
request.POST.getlist('pass_id')
Try following django >1.4 and use
request.POST.dict()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With