http.HttpResponse.charset

HttpResponse.charset A string denoting the charset in which the response will be encoded. If not given at HttpResponse instantiation time, it will be extracted from content_type and if that is unsuccessful, the DEFAULT_CHARSET setting will be used.

http.HttpResponse

class HttpResponse [source] In contrast to HttpRequest objects, which are created automatically by Django, HttpResponse objects are your responsibility. Each view you write is responsible for instantiating, populating and returning an HttpResponse. The HttpResponse class lives in the django.http module.

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.HttpRequest.xreadlines()

HttpRequest.xreadlines() [source]

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.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.site

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

http.HttpRequest.session

HttpRequest.session From the SessionMiddleware: A readable and writable, dictionary-like object that represents the current session.

http.HttpRequest.scheme

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

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).