def deploy_list(request,format=None): """ List all order, or create a server assets order. """ if request.method == 'GET': snippets = Project_Config.objects.all() serializer = serializers.ProjectConfigSerializer(snippets, many=True) return Response(serializer.data)
def deploy_detail(request, id,format=None): """ Retrieve, update or delete a server assets instance. """ try: snippet = Project_Config.objects.get(id=id) except Project_Config.DoesNotExist: return Response(status=status.HTTP_404_NOT_FOUND) if request.method == 'GET': serializer = serializers.ProjectConfigSerializer(snippet) return Response(serializer.data) elif request.method == 'DELETE': if not request.user.has_perm('OpsManage.delete_project_config'): return Response(status=status.HTTP_403_FORBIDDEN) recordProject.delay(project_user=str(request.user),project_id=id,project_name=snippet.project.project_name,project_content="删除项目") snippet.delete() return Response(status=status.HTTP_204_NO_CONTENT)