disable django_logout if REST_SESSION_LOGIN is False

This commit is contained in:
Jasper Wan 2019-02-03 11:42:24 +08:00
parent 479a40d2cc
commit a3d38f4c59

View File

@ -121,8 +121,8 @@ class LogoutView(APIView):
request.user.auth_token.delete() request.user.auth_token.delete()
except (AttributeError, ObjectDoesNotExist): except (AttributeError, ObjectDoesNotExist):
pass pass
if getattr(settings, 'REST_SESSION_LOGIN', True):
django_logout(request) django_logout(request)
return Response({"detail": _("Successfully logged out.")}, return Response({"detail": _("Successfully logged out.")},
status=status.HTTP_200_OK) status=status.HTTP_200_OK)