def deletepipeline(request, projectname, pipelinename):
try:
project = Project.objects.get(user=request.user, project_name=projectname)
except Project.DoesNotExist:
return HttpResponseNotFound('Nothing is here.')
try:
pipeline = Pipeline.objects.get(project=project, pipeline_name=pipelinename)
except Pipeline.DoesNotExist:
return HttpResponseNotFound('Nothing is here.')
if request.method == 'GET':
form = DeleteProject()
return render(request, 'deletepipeline.html',
{'username': request.user.username,
'form': form, 'projectname': project.project_name, 'pipelinename': pipeline.pipeline_name})
elif request.method == 'POST':
if 'cancel' in request.POST:
return HttpResponseRedirect(reverse("listpipelines", args=(project.project_name,)))
elif 'submit' in request.POST:
pipeline.delete()
return HttpResponseRedirect(reverse("listpipelines", args=(project.project_name,)))
views.py 文件源码
python
阅读 26
收藏 0
点赞 0
评论 0
评论列表
文章目录