本文整理汇总了Python中oozie.forms.WorkflowForm.save方法的典型用法代码示例。如果您正苦于以下问题:Python WorkflowForm.save方法的具体用法?Python WorkflowForm.save怎么用?Python WorkflowForm.save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oozie.forms.WorkflowForm
的用法示例。
在下文中一共展示了WorkflowForm.save方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: edit_workflow
# 需要导入模块: from oozie.forms import WorkflowForm [as 别名]
# 或者: from oozie.forms.WorkflowForm import save [as 别名]
def edit_workflow(request, workflow):
WorkflowFormSet = inlineformset_factory(Workflow, Node, form=NodeForm, max_num=0, can_order=False, can_delete=False)
history = History.objects.filter(submitter=request.user, job=workflow).order_by('-submission_date')
if request.method == 'POST' and Job.objects.can_edit_or_exception(request, workflow):
try:
workflow_form = WorkflowForm(request.POST, instance=workflow)
actions_formset = WorkflowFormSet(request.POST, request.FILES, instance=workflow)
if 'clone_action' in request.POST: return clone_action(request, action=request.POST['clone_action'])
if 'delete_action' in request.POST: return delete_action(request, action=request.POST['delete_action'])
if 'move_up_action' in request.POST: return move_up_action(request, action=request.POST['move_up_action'])
if 'move_down_action' in request.POST: return move_down_action(request, action=request.POST['move_down_action'])
if workflow_form.is_valid() and actions_formset.is_valid():
workflow_form.save()
actions_formset.save()
if workflow.has_cycle():
raise PopupException(_('Sorry, this operation is not creating a cycle which would break the workflow.'))
request.info(_("Workflow saved!"))
return redirect(reverse('oozie:edit_workflow', kwargs={'workflow': workflow.id}))
except Exception, e:
request.error(_('Sorry, this operation is not supported: %(error)s') % {'error': e})
示例2: create_workflow
# 需要导入模块: from oozie.forms import WorkflowForm [as 别名]
# 或者: from oozie.forms.WorkflowForm import save [as 别名]
def create_workflow(request):
workflow = Workflow.objects.new_workflow(request.user)
if request.method == "POST":
workflow_form = WorkflowForm(request.POST, instance=workflow)
if workflow_form.is_valid():
wf = workflow_form.save()
Workflow.objects.initialize(wf, request.fs)
return redirect(reverse("oozie:edit_workflow", kwargs={"workflow": workflow.id}))
else:
request.error(_("Errors on the form: %s") % workflow_form.errors)
else:
workflow_form = WorkflowForm(instance=workflow)
return render("editor/create_workflow.mako", request, {"workflow_form": workflow_form, "workflow": workflow})
示例3: create_workflow
# 需要导入模块: from oozie.forms import WorkflowForm [as 别名]
# 或者: from oozie.forms.WorkflowForm import save [as 别名]
def create_workflow(request):
workflow = Workflow.objects.new_workflow(request.user)
if request.method == 'POST':
workflow_form = WorkflowForm(request.POST, instance=workflow)
if workflow_form.is_valid():
wf = workflow_form.save()
wf.managed = True
Workflow.objects.initialize(wf, request.fs)
return redirect(reverse('oozie:edit_workflow', kwargs={'workflow': workflow.id}))
else:
workflow_form = WorkflowForm(instance=workflow)
return render('editor/create_workflow.mako', request, {
'workflow_form': workflow_form,
'workflow': workflow,
})