logout(request, next_page=None, template_name='registration/logged_out.html', redirect_field_name='next', current_app=None, extra_context=None)
Logs a user out.
URL name: logout
Optional arguments:
-
next_page
: The URL to redirect to after logout. Defaults tosettings.LOGOUT_REDIRECT_URL
if not supplied. -
template_name
: The full name of a template to display after logging the user out. Defaults toregistration/logged_out.html
if no argument is supplied. -
redirect_field_name
: The name of aGET
field containing the URL to redirect to after log out. Defaults tonext
. Overrides thenext_page
URL if the givenGET
parameter is passed. -
current_app
: A hint indicating which application contains the current view. See the namespaced URL resolution strategy for more information. -
extra_context
: A dictionary of context data that will be added to the default context data passed to the template.
Deprecated since version 1.9: The current_app
parameter is deprecated and will be removed in Django 2.0. Callers should set request.current_app
instead.
Template context:
-
title
: The string “Logged out”, localized. -
site
: The currentSite
, according to theSITE_ID
setting. If you don’t have the site framework installed, this will be set to an instance ofRequestSite
, which derives the site name and domain from the currentHttpRequest
. -
site_name
: An alias forsite.name
. If you don’t have the site framework installed, this will be set to the value ofrequest.META['SERVER_NAME']
. For more on sites, see The “sites” framework. -
current_app
: A hint indicating which application contains the current view. See the namespaced URL resolution strategy for more information. -
extra_context
: A dictionary of context data that will be added to the default context data passed to the template.
Please login to continue.