2023-10-25 09:35:24 -04:00
|
|
|
from django.shortcuts import render
|
|
|
|
from django.views import View
|
2023-10-25 10:10:23 -04:00
|
|
|
from django.http import HttpResponse, HttpRequest
|
2023-10-31 16:14:24 -04:00
|
|
|
from django.utils.decorators import method_decorator
|
|
|
|
from django.contrib.auth.decorators import login_required
|
2023-10-25 09:35:24 -04:00
|
|
|
|
|
|
|
from ..status_code import *
|
|
|
|
|
2023-10-25 10:10:23 -04:00
|
|
|
class DeleteView(View):
|
2023-10-31 16:14:24 -04:00
|
|
|
|
|
|
|
@method_decorator(login_required, name='dispatch')
|
2023-10-25 10:10:23 -04:00
|
|
|
def get(self, request: HttpRequest):
|
2023-10-31 16:14:24 -04:00
|
|
|
return HttpResponse(METHOD_INVALID)
|
2023-10-25 09:35:24 -04:00
|
|
|
|
2023-10-31 16:14:24 -04:00
|
|
|
@method_decorator(login_required, name='dispatch')
|
2023-10-25 10:10:23 -04:00
|
|
|
def post(self, request: HttpRequest):
|
2023-10-31 16:14:24 -04:00
|
|
|
request.user.delete()
|
2023-10-25 09:35:24 -04:00
|
|
|
return HttpResponse(USER_DELETED)
|
|
|
|
|