Sometimes, we want to take values from a POST request with Python Django.
In this article, we’ll look at how to take values from a POST request with Python Django.
How to take values from a POST request with Python Django?
To take values from a POST request with Python Django, we can use request.POST
.
For instance, we write
<input type="hidden" name="title" value="{{ source.title }}">
in our template.
Then in a view, we write
request.POST.get("title", "")
to get the input’s value by calling get
with the name
attribute value of the input field.
Conclusion
To take values from a POST request with Python Django, we can use request.POST
.