コード例 #1
0
ファイル: editor.py プロジェクト: yjkim/hue
def edit_bundle(request, bundle):
  history = History.objects.filter(submitter=request.user, job=bundle).order_by('-submission_date')

  BundledCoordinatorFormSet = inlineformset_factory(Bundle, BundledCoordinator, form=BundledCoordinatorForm, max_num=0, can_order=False, can_delete=True)
  bundle_form = BundleForm(instance=bundle)

  if request.method == 'POST':
    bundle_form = BundleForm(request.POST, instance=bundle)
    bundled_coordinator_formset = BundledCoordinatorFormSet(request.POST, instance=bundle)

    if bundle_form.is_valid() and bundled_coordinator_formset.is_valid():
      bundle = bundle_form.save()
      bundled_coordinator_formset.save()

      request.info(_('Bundle saved.'))
      return redirect(reverse('oozie:list_bundles'))
  else:
    bundle_form = BundleForm(instance=bundle)
    bundled_coordinator_formset = BundledCoordinatorFormSet(instance=bundle)

  return render('editor/edit_bundle.mako', request, {
    'bundle': bundle,
    'bundle_form': bundle_form,
    'bundled_coordinator_formset': bundled_coordinator_formset,
    'bundled_coordinator_html_form': get_create_bundled_coordinator_html(request, bundle),
    'history': history
  })
コード例 #2
0
ファイル: editor.py プロジェクト: hortonworkstest/hue
def edit_bundle(request, bundle):
    history = History.objects.filter(submitter=request.user, job=bundle).order_by("-submission_date")

    BundledCoordinatorFormSet = inlineformset_factory(
        Bundle, BundledCoordinator, form=BundledCoordinatorForm, max_num=0, can_order=False, can_delete=True
    )
    bundle_form = BundleForm(instance=bundle)

    if request.method == "POST":
        bundle_form = BundleForm(request.POST, instance=bundle)
        bundled_coordinator_formset = BundledCoordinatorFormSet(request.POST, instance=bundle)

        if bundle_form.is_valid() and bundled_coordinator_formset.is_valid():
            bundle = bundle_form.save()
            bundled_coordinator_formset.save()

            request.info(_("Bundle saved."))
            return redirect(reverse("oozie:list_bundles"))
    else:
        bundle_form = BundleForm(instance=bundle)
        bundled_coordinator_formset = BundledCoordinatorFormSet(instance=bundle)

    return render(
        "editor/edit_bundle.mako",
        request,
        {
            "bundle": bundle,
            "bundle_form": bundle_form,
            "bundled_coordinator_formset": bundled_coordinator_formset,
            "bundled_coordinator_html_form": get_create_bundled_coordinator_html(request, bundle),
            "history": history,
        },
    )
コード例 #3
0
def edit_bundle(request, bundle):
  history = History.objects.filter(submitter=request.user, job=bundle).order_by('-submission_date')

  BundledCoordinatorFormSet = inlineformset_factory(Bundle, BundledCoordinator, form=BundledCoordinatorForm, max_num=0, can_order=False, can_delete=True)
  bundle_form = BundleForm(instance=bundle)

  if request.method == 'POST':
    bundle_form = BundleForm(request.POST, instance=bundle)
    bundled_coordinator_formset = BundledCoordinatorFormSet(request.POST, instance=bundle)

    if bundle_form.is_valid() and bundled_coordinator_formset.is_valid():
      bundle = bundle_form.save()
      bundled_coordinator_formset.save()

      request.info(_('Bundle saved.'))
      return redirect(reverse('oozie:list_bundles'))
  else:
    bundle_form = BundleForm(instance=bundle)
    bundled_coordinator_formset = BundledCoordinatorFormSet(instance=bundle)

  return render('editor/edit_bundle.mako', request, {
    'bundle': bundle,
    'bundle_form': bundle_form,
    'bundled_coordinator_formset': bundled_coordinator_formset,
    'bundled_coordinator_html_form': get_create_bundled_coordinator_html(request, bundle),
    'history': history
  })
コード例 #4
0
ファイル: editor.py プロジェクト: hortonworkstest/hue
def create_bundle(request):
    bundle = Bundle(owner=request.user, schema_version="uri:oozie:bundle:0.2")

    if request.method == "POST":
        bundle_form = BundleForm(request.POST, instance=bundle)

        if bundle_form.is_valid():
            bundle = bundle_form.save()
            Document.objects.link(bundle, owner=bundle.owner, name=bundle.name, description=bundle.description)
            return redirect(reverse("oozie:edit_bundle", kwargs={"bundle": bundle.id}))
        else:
            request.error(_("Errors on the form: %s") % bundle_form.errors)
    else:
        bundle_form = BundleForm(instance=bundle)

    return render("editor/create_bundle.mako", request, {"bundle": bundle, "bundle_form": bundle_form})
コード例 #5
0
ファイル: editor.py プロジェクト: yjkim/hue
def create_bundle(request):
  bundle = Bundle(owner=request.user, schema_version='uri:oozie:bundle:0.2')

  if request.method == 'POST':
    bundle_form = BundleForm(request.POST, instance=bundle)

    if bundle_form.is_valid():
      bundle = bundle_form.save()
      return redirect(reverse('oozie:edit_bundle', kwargs={'bundle': bundle.id}))
    else:
      request.error(_('Errors on the form: %s') % bundle_form.errors)
  else:
    bundle_form = BundleForm(instance=bundle)

  return render('editor/create_bundle.mako', request, {
    'bundle': bundle,
    'bundle_form': bundle_form,
  })
コード例 #6
0
ファイル: editor.py プロジェクト: agibsonccc/hue
def create_bundle(request):
    bundle = Bundle(owner=request.user, schema_version='uri:oozie:bundle:0.2')

    if request.method == 'POST':
        bundle_form = BundleForm(request.POST, instance=bundle)

        if bundle_form.is_valid():
            bundle = bundle_form.save()
            return redirect(
                reverse('oozie:edit_bundle', kwargs={'bundle': bundle.id}))
        else:
            request.error(_('Errors on the form: %s') % bundle_form.errors)
    else:
        bundle_form = BundleForm(instance=bundle)

    return render('editor/create_bundle.mako', request, {
        'bundle': bundle,
        'bundle_form': bundle_form,
    })