A dictionary-like object containing all given HTTP POST parameters. See the
``QueryDict`` documentation below.
+ Note: ``POST`` does *not* include file-upload information. See ``FILES``.
For convenience, a dictionary-like object that searches ``POST`` first,
then ``GET``. Inspired by PHP's ``$_REQUEST``.
* ``SERVER_PORT`` -- The port of the server.
- A ``django.
models.auth. users.User`` object representing the currently
+ A ``django..auth.s.User`` object representing the currently
logged-in user. If the user isn't currently logged in, ``user`` will be set
to an instance of ``django.contrib.auth.models.AnonymousUser``. You
can tell them apart with ``is_anonymous()``, like so::
# Do something for logged-in users.
+ ``user`` is only available if your Django installation has the
+ ``AuthenticationMiddleware`` activated. For more, see
+ `Authentication in Web requests`_.
+ .. Authentication in Web requests: http://www.djangoproject.com/documentation/authentication/#authentication-in-web-requests
A readable-and-writable, dictionary-like object that represents the current
session. This is only available if your Django installation has session
In an ``HttpRequest`` object, the ``GET`` and ``POST`` attributes are instances
of ``django.http.QueryDict``. ``QueryDict`` is a dictionary-like
class customized to deal with multiple values for the same key. This is
-necessary because some HTML form elements, notably ``<select multiple>``, pass
-multiple values for the same key.
+necessary because some HTML form elements, notably
+``<select multiple="multiple">``, pass multiple values for the same key.
``QueryDict`` instances are immutable, unless you create a ``copy()`` of them.
That means you can't change attributes of ``request.POST`` and ``request.GET``
Typical usage is to pass the contents of the page, as a string, to the
Note that ``del`` doesn't raise ``KeyError`` if the header doesn't exist.
+Finally, you can pass ``HttpResponse`` an iterator rather than passing it
+hard-coded strings. If you use this technique, follow these guidelines:
+ * The iterator should return strings.
+ * If an ``HttpResponse`` has been initialized with an iterator as its
+ content, you can't use the ``HttpResponse`` instance as a file-like
+ object. Doing so will raise ``Exception``.
Instantiates an ``HttpResponse`` object with the given page content (a
- string) and MIME type. The ``DEFAULT_MIME_TYPE`` is ``
+ string) and MIME type. The ``DEFAULT_MIME_TYPE`` is ``text/html``.
``content`` can be an iterator or a string. If it's an iterator, it should
return strings, and those strings will be joined together to form the
The constructor takes a single argument -- the path to redirect to. This
- can be a fully qualified URL (e.g. ``"http://www.yahoo.com/search/"``) or an
- absolute URL with no domain (e.g. ``"/search/"``). Note that this returns
+ can be a fully qualified URL (e.g. ``'http://www.yahoo.com/search/'``) or an
+ absolute URL with no domain (e.g. ``'/search/'``). Note that this returns