diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2006-06-20 03:48:31 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2006-06-20 03:48:31 +0000 |
| commit | 136752ca9a87be908f9ec1e398bbd56b0c75222c (patch) | |
| tree | f8ba00ebfda2cb7bd0c559ac3064407bcbc68330 /docs | |
| parent | a09682fd6376159f81de9d6dc8c86ebd4e0b6513 (diff) | |
Added 'method' attribute to HttpRequest objects
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3164 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/request_response.txt | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/docs/request_response.txt b/docs/request_response.txt index 4939cac76f..607839350e 100644 --- a/docs/request_response.txt +++ b/docs/request_response.txt @@ -29,6 +29,15 @@ All attributes except ``session`` should be considered read-only. Example: ``"/music/bands/the_beatles/"`` +``method`` + A string representing the HTTP method used in the request. This is + guaranteed to be uppercase. Example:: + + if request.method == 'GET': + do_something() + elif request.method == 'POST': + do_something_else() + ``GET`` A dictionary-like object containing all given HTTP GET parameters. See the ``QueryDict`` documentation below. @@ -37,6 +46,11 @@ All attributes except ``session`` should be considered read-only. A dictionary-like object containing all given HTTP POST parameters. See the ``QueryDict`` documentation below. + It's possible that a request can come in via POST with an empty ``POST`` + dictionary -- if, say, a form is requested via the POST HTTP method but + does not include form data. Therefore, you shouldn't use ``if request.POST`` + to check for use of the POST method; instead, check `method`_. + Note: ``POST`` does *not* include file-upload information. See ``FILES``. ``REQUEST`` |
