Skip to content

Commit

Permalink
Merge pull request #149
Browse files Browse the repository at this point in the history
feat(project): change hard project  delete to logic delete lihuacai A minute ago
  • Loading branch information
lihuacai168 authored Jan 10, 2024
2 parents 9a266b3 + 5268f1d commit ac881f5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions fastrunner/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class Meta:
jira_bearer_token = models.CharField(
"jira bearer_token", null=False, default="", max_length=45, blank=True
)
is_deleted = models.IntegerField("是否删除", null=True, default=0)


class Debugtalk(BaseTable):
Expand Down
9 changes: 5 additions & 4 deletions fastrunner/views/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ProjectView(GenericViewSet):
项目增删改查
"""

queryset = models.Project.objects.all().order_by("-update_time")
queryset = models.Project.objects.filter(is_deleted=0).all().order_by("-update_time")
serializer_class = serializers.ProjectSerializer
pagination_class = pagination.MyCursorPagination

Expand Down Expand Up @@ -97,9 +97,10 @@ def delete(self, request):
return Response(status=status.HTTP_401_UNAUTHORIZED)
try:
project = models.Project.objects.get(id=request.data["id"])

project.delete()
prepare.project_end(project)
# 改完软删除
project.is_deleted = 1
project.save(update_fields=['is_deleted'])
# prepare.project_end(project)

return Response(response.PROJECT_DELETE_SUCCESS)
except ObjectDoesNotExist:
Expand Down
1 change: 0 additions & 1 deletion web/src/pages/project/ProjectList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@
<el-button
size="medium"
type="danger"
v-show="false"
:title="isSuperuser ? '删除项目' : '权限不足,请联系管理员'"
:disabled="!isSuperuser"
@click="handleDelete(scope.$index, scope.row)"
Expand Down

0 comments on commit ac881f5

Please sign in to comment.