MCPcopy
hub / github.com/django/django / logout

Method logout

django/contrib/admin/sites.py:392–412  ·  view source on GitHub ↗

Log out the user for the given HttpRequest. This should *not* assume the user is already logged in.

(self, request, extra_context=None)

Source from the content-addressed store, hash-verified

390 return JavaScriptCatalog.as_view(packages=["django.contrib.admin"])(request)
391
392 def logout(self, request, extra_context=None):
393 """
394 Log out the user for the given HttpRequest.
395
396 This should *not* assume the user is already logged in.
397 """
398 from django.contrib.auth.views import LogoutView
399
400 defaults = {
401 "extra_context": {
402 **self.each_context(request),
403 # Since the user isn't logged out at this point, the value of
404 # has_permission must be overridden.
405 "has_permission": False,
406 **(extra_context or {}),
407 },
408 }
409 if self.logout_template is not None:
410 defaults["template_name"] = self.logout_template
411 request.current_app = self.name
412 return LogoutView.as_view(**defaults)(request)
413
414 @method_decorator(never_cache)
415 @login_not_required

Callers 1

_remove_invalid_userMethod · 0.45

Calls 2

each_contextMethod · 0.95
as_viewMethod · 0.45

Tested by

no test coverage detected