HttpRequest Attributes: POST
POST attribute of Django's
HttpRequest Python class is a dictionary-like object containing all the given HTTP
POST parameters if the request contains form data (raw, non-form data posted in the request is accessed through the
HttpRequest.body attribute instead.).
A request using the
POST method can have an empty
POST dictionary if for example a form is submitted using the HTTP
POST method but does not include form data. For this reason, you shouldn’t use
if request.POST to check for use of the HTTP
POST method. Instead, you should use
if request.method == "POST". Also remember that
POST does not include file-upload information (the
HttpRequest.FILES attribute does).