class documentation

class CsrfViewMiddleware(MiddlewareMixin):

Known subclasses: django.views.decorators.csrf._EnsureCsrfCookie, django.views.decorators.csrf._EnsureCsrfToken

View In Hierarchy

Require a present and correct csrfmiddlewaretoken for POST requests that have a CSRF cookie, and set an outgoing CSRF cookie.

This middleware should be used in conjunction with the {% csrf_token %} template tag.

Method ​_accept Undocumented
Method ​_bad​_token​_message Undocumented
Method ​_check​_referer Undocumented
Method ​_check​_token Undocumented
Method ​_get​_token Undocumented
Method ​_origin​_verified Undocumented
Method ​_reject Undocumented
Method ​_set​_csrf​_cookie Undocumented
Method process​_request Undocumented
Method process​_response Undocumented
Method process​_view Undocumented
Property allowed​_origin​_subdomains A mapping of allowed schemes to list of allowed netlocs, where all subdomains of the netloc are allowed.
Property allowed​_origins​_exact Undocumented
Property csrf​_trusted​_origins​_hosts Undocumented

Inherited from MiddlewareMixin:

Async Method __acall__ Async version of __call__ that is swapped in when an async request is running.
Method __call__ Undocumented
Method __init__ Undocumented
Method __repr__ Undocumented
Method ​_async​_check If get_response is a coroutine function, turns us into async mode so a thread is not consumed during a whole request.
Class Variable async​_capable Undocumented
Class Variable sync​_capable Undocumented
Instance Variable ​_is​_coroutine Undocumented
Instance Variable get​_response Undocumented
def _accept(self, request):

Undocumented

def _bad_token_message(self, reason, token_source):

Undocumented

def _check_referer(self, request):

Undocumented

def _check_token(self, request):

Undocumented

def _get_token(self, request):

Undocumented

def _origin_verified(self, request):

Undocumented

def _reject(self, request, reason):
def _set_csrf_cookie(self, request, response):

Undocumented

def process_request(self, request):

Undocumented

def process_response(self, request, response):

Undocumented

def process_view(self, request, callback, callback_args, callback_kwargs):
@cached_property
allowed_origin_subdomains =
A mapping of allowed schemes to list of allowed netlocs, where all subdomains of the netloc are allowed.
@cached_property
allowed_origins_exact =

Undocumented

@cached_property
csrf_trusted_origins_hosts =

Undocumented