[Update] 修改删除节点 API 返回的状态码

pull/3323/head
BaiJiangJie 5 years ago
parent 5f96f8c229
commit 7ff6391801

@ -62,11 +62,8 @@ class NodeViewSet(OrgModelViewSet):
def destroy(self, request, *args, **kwargs):
node = self.get_object()
if node.has_children_or_contains_assets():
msg = _("Deletion failed "
"and the node contains children or assets")
return Response(
data={'msg': msg}, status=status.HTTP_500_INTERNAL_SERVER_ERROR
)
msg = _("Deletion failed and the node contains children or assets")
return Response(data={'msg': msg}, status=status.HTTP_403_FORBIDDEN)
return super().destroy(request, *args, **kwargs)

Loading…
Cancel
Save