ft_transcendence/accounts/views/delete.py

12 lines
490 B
Python

from rest_framework.views import APIView
from rest_framework import permissions, status
from rest_framework.response import Response
from django.http import HttpRequest
from rest_framework.authentication import SessionAuthentication
class DeleteView(APIView):
permission_classes = (permissions.IsAuthenticated,)
authentication_classes = (SessionAuthentication,)
def delete(self, request: HttpRequest):
request.user.delete()
return Response("user deleted", status=status.HTTP_200_OK)