csrf
Context processor that provides a CSRF token, or the string 'NOTPROVIDED' if it has not been provided by either a view decorator or the middleware
def csrf(
request: HttpRequest
) - > dict
Context processor that provides a CSRF token, or the string 'NOTPROVIDED' if it has not been provided by either a view decorator or the middleware
Parameters
| Name | Type | Description |
|---|---|---|
| request | HttpRequest | The current HTTP request object used to retrieve the CSRF token from the middleware or view context. |
Returns
| Type | Description |
|---|---|
dict | A dictionary containing a 'csrf_token' key mapped to a lazy object that resolves to the CSRF token string or a 'NOTPROVIDED' sentinel value. |