Renamed the logout_view() function to logout().

This commit is contained in:
依瑪貓 2020-07-06 23:06:45 +08:00
parent 68be53e212
commit 66f1e4b4fa

View File

@ -1,10 +1,10 @@
from django.contrib.auth import logout
from django.contrib.auth import logout as logout_user
from django.shortcuts import redirect
from django.views.decorators.http import require_POST
@require_POST
def logout_view(request):
def logout(request):
"""The view to log out a user.
Args:
@ -13,7 +13,7 @@ def logout_view(request):
Returns:
HttpRedirectResponse: The redirect response.
"""
logout(request)
logout_user(request)
if "next" in request.POST:
request.session["logout"] = True
return redirect(request.POST["next"])