def post(self, *args, **kwargs): """ safe guard for POST to make sure only owner can delete his own poll """ question = get_object_or_404(Question,pk=kwargs['pk']) if question.created_by == self.request.user : return DeleteView.post(self, *args, **kwargs) else : return HttpResponseForbidden('you are not allowed to do this')
def post(self, request, *args, **kwargs): DeleteView.post(self, request, *args, **kwargs) return JsonResponse({})
def post(self, request, *args, **kwargs): logout(request) messages.add_message(request, messages.SUCCESS, 'Пользователь удалён') return DeleteView.post(self, request, *args, **kwargs)