You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
flyapps/fir_ser/api/views/logout.py

16 lines
511 B

from rest_framework.views import APIView
from api.utils.auth import ExpiringTokenAuthentication
from api.models import Token
from rest_framework.response import Response
from api.utils.permission import LoginUserPermission
class LogoutView(APIView):
authentication_classes = [ExpiringTokenAuthentication]
permission_classes = [LoginUserPermission]
def delete(self, request):
user = request.user.pk
Token.objects.filter(user=user).delete()
return Response({"code": 1000})