當前位置: 首頁>>代碼示例>>Python>>正文


Python WorkflowForm.save方法代碼示例

本文整理匯總了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})
開發者ID:kthguru,項目名稱:hue,代碼行數:27,代碼來源:editor.py

示例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})
開發者ID:romainr,項目名稱:hue,代碼行數:18,代碼來源:editor.py

示例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,
  })
開發者ID:18600597055,項目名稱:hue,代碼行數:20,代碼來源:editor.py


注:本文中的oozie.forms.WorkflowForm.save方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。