http.HttpRequest.__iter__()

HttpRequest.__iter__() Methods implementing a file-like interface for reading from an HttpRequest instance. This makes it possible to consume an incoming request in a streaming fashion. A common use-case would be to process a big XML payload with an iterative parser without constructing a whole XML tree in memory. Given this standard interface, an HttpRequest instance can be passed directly to an XML parser such as ElementTree: import xml.etree.ElementTree as ET for element in ET.iterparse(r

http.HttpResponse.delete_cookie()

HttpResponse.delete_cookie(key, path='/', domain=None) Deletes the cookie with the given key. Fails silently if the key doesn’t exist. Due to the way cookies work, path and domain should be the same values you used in set_cookie() – otherwise the cookie may not be deleted.

http.HttpResponse.content

HttpResponse.content A bytestring representing the content, encoded from a Unicode object if necessary.

http.HttpRequest.site

HttpRequest.site From the CurrentSiteMiddleware: An instance of Site or RequestSite as returned by get_current_site() representing the current site.

http.HttpRequest.user

HttpRequest.user From the AuthenticationMiddleware: An instance of AUTH_USER_MODEL representing the currently logged-in user. If the user isn’t currently logged in, user will be set to an instance of AnonymousUser. You can tell them apart with is_authenticated, like so: if request.user.is_authenticated: ... # Do something for logged-in users. else: ... # Do something for anonymous users.

http.HttpRequest.xreadlines()

HttpRequest.xreadlines() [source]

http.HttpRequest.urlconf

HttpRequest.urlconf This will be used as the root URLconf for the current request, overriding the ROOT_URLCONF setting. See How Django processes a request for details. urlconf can be set to None to revert any changes made by previous middleware and return to using the ROOT_URLCONF. Changed in Django 1.9: Setting urlconf=None raised ImproperlyConfigured in older versions.

http.HttpRequest.scheme

HttpRequest.scheme A string representing the scheme of the request (http or https usually).

http.HttpRequest.readline()

HttpRequest.readline() [source]

http.HttpRequest.resolver_match

HttpRequest.resolver_match An instance of ResolverMatch representing the resolved URL. This attribute is only set after URL resolving took place, which means it’s available in all views but not in middleware which are executed before URL resolving takes place (you can use it in process_view() though).