Django - request POST

django, post, request

Solution

If you want to check the request method, use `if request.method == 'POST'`.

`request.POST` is the post param dict, and you shouldn't count on its existence or lack thereof when it comes to the request method. (e.g. a post request with no params fails on that test.)

Explicit is better than implicit. -- PEP 20, Zen of Python

Problem

Shall I use (and why?): ``` if request.POST ``` or: ``` if request.method == 'POST' ``` Is there any differences except syntax?

Original source