def delete(self, request): """ 删除项目 """ try: project = models.Project.objects.get(id=request.data['id']) project.delete() prepare.project_end(project) return Response(response.PROJECT_DELETE_SUCCESS) except ObjectDoesNotExist: return Response(response.SYSTEM_ERROR)
def delete(self, request): """ 删除项目 """ if request.user.is_superuser is False: return Response(status=status.HTTP_401_UNAUTHORIZED) try: project = models.Project.objects.get(id=request.data['id']) project.delete() prepare.project_end(project) return Response(response.PROJECT_DELETE_SUCCESS) except ObjectDoesNotExist: return Response(response.SYSTEM_ERROR)