当前位置: 首页>>代码示例>>Python>>正文


Python forms.DatasetForm类代码示例

本文整理汇总了Python中oozie.forms.DatasetForm的典型用法代码示例。如果您正苦于以下问题:Python DatasetForm类的具体用法?Python DatasetForm怎么用?Python DatasetForm使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了DatasetForm类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: edit_coordinator_dataset

def edit_coordinator_dataset(request, dataset):
  """Returns HTML for modal to edit datasets"""

  response = {'status': -1, 'data': 'None'}

  if request.method == 'POST':
    dataset_form = DatasetForm(request.POST, instance=dataset, prefix='edit')

    if dataset_form.is_valid():
      dataset = dataset_form.save()
      response['status'] = 0
      response['data'] = reverse('oozie:edit_coordinator', kwargs={'coordinator': dataset.coordinator.id}) + "#listDataset"
      request.info(_('Dataset modified'))
      if dataset.start > dataset.coordinator.start:
        request.error(_('Beware: dataset start date was after the coordinator start date.'))
    else:
      response['data'] = dataset_form.errors
  else:
    dataset_form = DatasetForm(instance=dataset, prefix='edit')

  if response['status'] != 0:
    response['data'] = render('editor/edit_coordinator_dataset.mako', request, {
                          'coordinator': dataset.coordinator,
                          'dataset_form': dataset_form,
                          'dataset': dataset,
                          'path': request.path,
                        }, force_template=True).content

  return HttpResponse(json.dumps(response), mimetype="application/json")
开发者ID:yjkim,项目名称:hue,代码行数:29,代码来源:editor.py

示例2: create_coordinator_dataset

def create_coordinator_dataset(request, coordinator):
  """Returns {'status' 0/1, data:html or url}"""

  dataset = Dataset(coordinator=coordinator)
  response = {'status': -1, 'data': 'None'}

  if request.method == 'POST':
    dataset_form = DatasetForm(request.POST, instance=dataset, prefix='create')

    if dataset_form.is_valid():
      dataset_form.save()
      response['status'] = 0
      response['data'] = reverse('oozie:edit_coordinator', kwargs={'coordinator': coordinator.id}) + "#listDataset"
      request.info(_('Dataset created'))
  else:
    ## Bad
    response['data'] = _('A POST request is required.')

  if response['status'] != 0:
    response['data'] = render('editor/create_coordinator_dataset.mako', request, {
                            'coordinator': coordinator,
                            'dataset_form': dataset_form,
                            'dataset': dataset,
                          }, force_template=True).content

  return HttpResponse(json.dumps(response), mimetype="application/json")
开发者ID:yjkim,项目名称:hue,代码行数:26,代码来源:editor.py

示例3: create_coordinator_dataset

def create_coordinator_dataset(request, coordinator):
    """Returns {'status' 0/1, data:html or url}"""

    dataset = Dataset(coordinator=coordinator)
    response = {"status": -1, "data": "None"}

    if request.method == "POST":
        dataset_form = DatasetForm(request.POST, instance=dataset, prefix="create")

        if dataset_form.is_valid():
            dataset_form.save()
            response["status"] = 0
            response["data"] = (
                reverse("oozie:edit_coordinator", kwargs={"coordinator": coordinator.id}) + "#listDataset"
            )
            request.info(_("Dataset created"))
    else:
        ## Bad
        response["data"] = _("A POST request is required.")

    if response["status"] != 0:
        response["data"] = render(
            "editor/create_coordinator_dataset.mako",
            request,
            {"coordinator": coordinator, "dataset_form": dataset_form, "dataset": dataset},
            force_template=True,
        ).content

    return HttpResponse(json.dumps(response), mimetype="application/json")
开发者ID:romainr,项目名称:hue,代码行数:29,代码来源:editor.py

示例4: edit_coordinator_dataset

def edit_coordinator_dataset(request, dataset):
    """Returns HTML for modal to edit datasets"""

    response = {"status": -1, "data": "None"}

    if request.method == "POST":
        dataset_form = DatasetForm(request.POST, instance=dataset, prefix="edit")

        if dataset_form.is_valid():
            dataset = dataset_form.save()
            response["status"] = 0
            response["data"] = (
                reverse("oozie:edit_coordinator", kwargs={"coordinator": dataset.coordinator.id}) + "#listDataset"
            )
            request.info(_("Dataset modified"))
            if dataset.start > dataset.coordinator.start:
                request.error(_("Beware: dataset start date was after the coordinator start date."))
        else:
            response["data"] = dataset_form.errors
    else:
        dataset_form = DatasetForm(instance=dataset, prefix="edit")

    if response["status"] != 0:
        response["data"] = render(
            "editor/edit_coordinator_dataset.mako",
            request,
            {
                "coordinator": dataset.coordinator,
                "dataset_form": dataset_form,
                "dataset": dataset,
                "path": request.path,
            },
            force_template=True,
        ).content

    return HttpResponse(json.dumps(response), mimetype="application/json")
开发者ID:romainr,项目名称:hue,代码行数:36,代码来源:editor.py

示例5: edit_coordinator_dataset

def edit_coordinator_dataset(request, dataset):
  """Returns HTML for modal to edit datasets"""

  if request.method == 'POST':
    dataset_form = DatasetForm(request.POST, instance=dataset)

    if dataset_form.is_valid():
      dataset_form.save()
      request.info(_('Dataset modified'));
      return redirect(reverse('oozie:edit_coordinator', kwargs={'coordinator': dataset.coordinator.id}))
    else:
      dataset_form = DatasetForm(request.POST, instance=dataset)
  else:
    dataset_form = DatasetForm(instance=dataset)

  return render('editor/edit_coordinator_dataset.mako', request, {
    'coordinator': dataset.coordinator,
    'dataset_form': dataset_form,
    'path': request.path,
  }, force_template=True)
开发者ID:ahonko,项目名称:hue,代码行数:20,代码来源:editor.py

示例6: edit_coordinator_dataset

def edit_coordinator_dataset(request, dataset):
    """Returns HTML for modal to edit datasets"""

    if request.method == "POST":
        dataset_form = DatasetForm(request.POST, instance=dataset)

        if dataset_form.is_valid():
            dataset_form.save()
            request.info(_("Dataset modified"))
            return redirect(reverse("oozie:edit_coordinator", kwargs={"coordinator": dataset.coordinator.id}))
        else:
            dataset_form = DatasetForm(request.POST, instance=dataset)
    else:
        dataset_form = DatasetForm(instance=dataset)

    return render(
        "editor/edit_coordinator_dataset.mako",
        request,
        {"coordinator": dataset.coordinator, "dataset_form": dataset_form, "path": request.path},
        force_template=True,
    )
开发者ID:fty650660,项目名称:hue,代码行数:21,代码来源:editor.py


注:本文中的oozie.forms.DatasetForm类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。