Changeset 2786
- Timestamp:
- 04/28/06 21:11:02 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/magic-removal/docs/request_response.txt
r2744 r2786 37 37 A dictionary-like object containing all given HTTP POST parameters. See the 38 38 ``QueryDict`` documentation below. 39 40 Note: ``POST`` does *not* include file-upload information. See ``FILES``. 39 41 40 42 ``REQUEST`` … … 87 89 88 90 ``user`` 89 A ``django. models.auth.users.User`` object representing the currently91 A ``django.contrib.auth.models.User`` object representing the currently 90 92 logged-in user. If the user isn't currently logged in, ``user`` will be set 91 93 to an instance of ``django.contrib.auth.models.AnonymousUser``. You … … 97 99 # Do something for logged-in users. 98 100 101 ``user`` is only available if your Django installation has the 102 ``AuthenticationMiddleware`` activated. For more, see 103 `Authentication in Web requests`_. 104 105 .. Authentication in Web requests: http://www.djangoproject.com/documentation/authentication/#authentication-in-web-requests 106 99 107 ``session`` 100 108 A readable-and-writable, dictionary-like object that represents the current … … 134 142 of ``django.http.QueryDict``. ``QueryDict`` is a dictionary-like 135 143 class customized to deal with multiple values for the same key. This is 136 necessary because some HTML form elements, notably ``<select multiple>``, pass137 multiple values for the same key.144 necessary because some HTML form elements, notably 145 ``<select multiple="multiple">``, pass multiple values for the same key. 138 146 139 147 ``QueryDict`` instances are immutable, unless you create a ``copy()`` of them. … … 275 283 ----- 276 284 285 Passing strings 286 ~~~~~~~~~~~~~~~ 287 277 288 Typical usage is to pass the contents of the page, as a string, to the 278 289 ``HttpResponse`` constructor:: … … 298 309 Note that ``del`` doesn't raise ``KeyError`` if the header doesn't exist. 299 310 311 Passing iterators 312 ~~~~~~~~~~~~~~~~~ 313 314 Finally, you can pass ``HttpResponse`` an iterator rather than passing it 315 hard-coded strings. If you use this technique, follow these guidelines: 316 317 * The iterator should return strings. 318 * If an ``HttpResponse`` has been initialized with an iterator as its 319 content, you can't use the ``HttpResponse`` instance as a file-like 320 object. Doing so will raise ``Exception``. 321 300 322 Methods 301 323 ------- … … 303 325 ``__init__(content='', mimetype=DEFAULT_MIME_TYPE)`` 304 326 Instantiates an ``HttpResponse`` object with the given page content (a 305 string) and MIME type. The ``DEFAULT_MIME_TYPE`` is `` "text/html"``.327 string) and MIME type. The ``DEFAULT_MIME_TYPE`` is ``'text/html'``. 306 328 307 329 ``content`` can be an iterator or a string. If it's an iterator, it should … … 361 383 ``HttpResponseRedirect`` 362 384 The constructor takes a single argument -- the path to redirect to. This 363 can be a fully qualified URL (e.g. `` "http://www.yahoo.com/search/"``) or an364 absolute URL with no domain (e.g. `` "/search/"``). Note that this returns385 can be a fully qualified URL (e.g. ``'http://www.yahoo.com/search/'``) or an 386 absolute URL with no domain (e.g. ``'/search/'``). Note that this returns 365 387 an HTTP status code 302. 366 388
