from django.shortcuts import render from django.views import View from django.http import HttpResponse, HttpRequest from django.utils.decorators import method_decorator from django.contrib.auth.decorators import login_required from ..status_code import * class DeleteView(View): @method_decorator(login_required, name='dispatch') def get(self, request: HttpRequest): return HttpResponse(METHOD_INVALID) @method_decorator(login_required, name='dispatch') def post(self, request: HttpRequest): request.user.delete() return HttpResponse(USER_DELETED)