本文整理汇总了Python中oozie.forms.CoordinatorForm.is_valid方法的典型用法代码示例。如果您正苦于以下问题:Python CoordinatorForm.is_valid方法的具体用法?Python CoordinatorForm.is_valid怎么用?Python CoordinatorForm.is_valid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oozie.forms.CoordinatorForm
的用法示例。
在下文中一共展示了CoordinatorForm.is_valid方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_coordinator
# 需要导入模块: from oozie.forms import CoordinatorForm [as 别名]
# 或者: from oozie.forms.CoordinatorForm import is_valid [as 别名]
def create_coordinator(request, workflow=None):
if workflow is not None:
coordinator = Coordinator(owner=request.user, schema_version="uri:oozie:coordinator:0.2", workflow=workflow)
else:
coordinator = Coordinator(owner=request.user, schema_version="uri:oozie:coordinator:0.2")
enable_cron_scheduling = ENABLE_CRON_SCHEDULING.get()
if request.method == 'POST':
coordinator_form = CoordinatorForm(request.POST, instance=coordinator, user=request.user)
if coordinator_form.is_valid():
coordinator = coordinator_form.save()
if enable_cron_scheduling:
coordinator.cron_frequency = {'frequency': request.POST.get('cron_frequency'), 'isAdvancedCron': request.POST.get('isAdvancedCron') == 'on'}
coordinator.save()
Document.objects.link(coordinator, owner=coordinator.owner, name=coordinator.name, description=coordinator.description)
return redirect(reverse('oozie:edit_coordinator', kwargs={'coordinator': coordinator.id}) + "#step3")
else:
request.error(_('Errors on the form: %s') % coordinator_form.errors)
else:
coordinator_form = CoordinatorForm(instance=coordinator, user=request.user)
return render('editor/create_coordinator.mako', request, {
'coordinator': coordinator,
'coordinator_form': coordinator_form,
'coordinator_frequency': json.dumps(coordinator.cron_frequency),
'enable_cron_scheduling': enable_cron_scheduling,
})
示例2: edit_coordinator
# 需要导入模块: from oozie.forms import CoordinatorForm [as 别名]
# 或者: from oozie.forms.CoordinatorForm import is_valid [as 别名]
def edit_coordinator(request, coordinator):
history = History.objects.filter(submitter=request.user, job=coordinator).order_by('-submission_date')
DatasetFormSet = inlineformset_factory(Coordinator, Dataset, form=DatasetForm, max_num=0, can_order=False, can_delete=True)
DataInputFormSet = inlineformset_factory(Coordinator, DataInput, form=DataInputForm, max_num=0, can_order=False, can_delete=True)
DataInputFormSet.form = staticmethod(curry(DataInputForm, coordinator=coordinator))
DataOutputFormSet = inlineformset_factory(Coordinator, DataOutput, form=DataOutputForm, max_num=0, can_order=False, can_delete=True)
DataOutputFormSet.form = staticmethod(curry(DataOutputForm, coordinator=coordinator))
dataset = Dataset(coordinator=coordinator)
dataset_form = DatasetForm(instance=dataset, prefix='create')
NewDataInputFormSet = inlineformset_factory(Coordinator, DataInput, form=DataInputForm, extra=0, can_order=False, can_delete=False)
NewDataInputFormSet.form = staticmethod(curry(DataInputForm, coordinator=coordinator))
NewDataOutputFormSet = inlineformset_factory(Coordinator, DataOutput, form=DataOutputForm, extra=0, can_order=False, can_delete=False)
NewDataOutputFormSet.form = staticmethod(curry(DataOutputForm, coordinator=coordinator))
if request.method == 'POST':
coordinator_form = CoordinatorForm(request.POST, instance=coordinator, user=request.user)
dataset_formset = DatasetFormSet(request.POST, request.FILES, instance=coordinator)
data_input_formset = DataInputFormSet(request.POST, request.FILES, instance=coordinator)
data_output_formset = DataOutputFormSet(request.POST, request.FILES, instance=coordinator)
new_data_input_formset = NewDataInputFormSet(request.POST, request.FILES, instance=coordinator, prefix='input')
new_data_output_formset = NewDataOutputFormSet(request.POST, request.FILES, instance=coordinator, prefix='output')
if coordinator_form.is_valid() and dataset_formset.is_valid() and data_input_formset.is_valid() and data_output_formset.is_valid() \
and new_data_input_formset.is_valid() and new_data_output_formset.is_valid():
coordinator = coordinator_form.save()
dataset_formset.save()
data_input_formset.save()
data_output_formset.save()
new_data_input_formset.save()
new_data_output_formset.save()
coordinator.sla = json.loads(request.POST.get('sla'))
coordinator.save()
request.info(_('Coordinator saved.'))
return redirect(reverse('oozie:edit_coordinator', kwargs={'coordinator': coordinator.id}))
else:
coordinator_form = CoordinatorForm(instance=coordinator, user=request.user)
dataset_formset = DatasetFormSet(instance=coordinator)
data_input_formset = DataInputFormSet(instance=coordinator)
data_output_formset = DataOutputFormSet(instance=coordinator)
new_data_input_formset = NewDataInputFormSet(queryset=DataInput.objects.none(), instance=coordinator, prefix='input')
new_data_output_formset = NewDataOutputFormSet(queryset=DataOutput.objects.none(), instance=coordinator, prefix='output')
return render('editor/edit_coordinator.mako', request, {
'coordinator': coordinator,
'coordinator_form': coordinator_form,
'dataset_formset': dataset_formset,
'data_input_formset': data_input_formset,
'data_output_formset': data_output_formset,
'dataset': dataset,
'dataset_form': dataset_form,
'new_data_input_formset': new_data_input_formset,
'new_data_output_formset': new_data_output_formset,
'history': history
})
示例3: create_coordinator
# 需要导入模块: from oozie.forms import CoordinatorForm [as 别名]
# 或者: from oozie.forms.CoordinatorForm import is_valid [as 别名]
def create_coordinator(request, workflow=None):
if workflow is not None:
coordinator = Coordinator(owner=request.user, schema_version="uri:oozie:coordinator:0.1", workflow=workflow)
else:
coordinator = Coordinator(owner=request.user, schema_version="uri:oozie:coordinator:0.1")
if request.method == "POST":
coordinator_form = CoordinatorForm(request.POST, instance=coordinator, user=request.user)
if coordinator_form.is_valid():
coordinator = coordinator_form.save()
return redirect(reverse("oozie:edit_coordinator", kwargs={"coordinator": coordinator.id}) + "#step3")
else:
request.error(_("Errors on the form: %s") % coordinator_form.errors)
else:
coordinator_form = CoordinatorForm(instance=coordinator, user=request.user)
return render(
"editor/create_coordinator.mako", request, {"coordinator": coordinator, "coordinator_form": coordinator_form}
)
示例4: create_coordinator
# 需要导入模块: from oozie.forms import CoordinatorForm [as 别名]
# 或者: from oozie.forms.CoordinatorForm import is_valid [as 别名]
def create_coordinator(request, workflow=None):
if workflow is not None:
coordinator = Coordinator(owner=request.user, schema_version="uri:oozie:coordinator:0.1", workflow=workflow)
else:
coordinator = Coordinator(owner=request.user, schema_version="uri:oozie:coordinator:0.1")
if request.method == 'POST':
coordinator_form = CoordinatorForm(request.POST, instance=coordinator, user=request.user)
if coordinator_form.is_valid():
coordinator = coordinator_form.save()
return redirect(reverse('oozie:edit_coordinator', kwargs={'coordinator': coordinator.id}) + "#step3")
else:
request.error(_('Errors on the form: %s') % coordinator_form.errors)
else:
coordinator_form = CoordinatorForm(instance=coordinator, user=request.user)
return render('editor/create_coordinator.mako', request, {
'coordinator': coordinator,
'coordinator_form': coordinator_form,
})
示例5: edit_coordinator
# 需要导入模块: from oozie.forms import CoordinatorForm [as 别名]
# 或者: from oozie.forms.CoordinatorForm import is_valid [as 别名]
def edit_coordinator(request, coordinator):
history = History.objects.filter(submitter=request.user, job=coordinator).order_by("-submission_date")
DatasetFormSet = inlineformset_factory(
Coordinator, Dataset, form=DatasetForm, max_num=0, can_order=False, can_delete=True
)
DataInputFormSet = inlineformset_factory(
Coordinator, DataInput, form=DataInputForm, max_num=0, can_order=False, can_delete=True
)
DataInputFormSet.form = staticmethod(curry(DataInputForm, coordinator=coordinator))
DataOutputFormSet = inlineformset_factory(
Coordinator, DataOutput, form=DataOutputForm, max_num=0, can_order=False, can_delete=True
)
DataOutputFormSet.form = staticmethod(curry(DataOutputForm, coordinator=coordinator))
dataset = Dataset(coordinator=coordinator)
dataset_form = DatasetForm(instance=dataset, prefix="create")
NewDataInputFormSet = inlineformset_factory(
Coordinator, DataInput, form=DataInputForm, extra=0, can_order=False, can_delete=False
)
NewDataInputFormSet.form = staticmethod(curry(DataInputForm, coordinator=coordinator))
NewDataOutputFormSet = inlineformset_factory(
Coordinator, DataOutput, form=DataOutputForm, extra=0, can_order=False, can_delete=False
)
NewDataOutputFormSet.form = staticmethod(curry(DataOutputForm, coordinator=coordinator))
if request.method == "POST":
coordinator_form = CoordinatorForm(request.POST, instance=coordinator, user=request.user)
dataset_formset = DatasetFormSet(request.POST, request.FILES, instance=coordinator)
data_input_formset = DataInputFormSet(request.POST, request.FILES, instance=coordinator)
data_output_formset = DataOutputFormSet(request.POST, request.FILES, instance=coordinator)
new_data_input_formset = NewDataInputFormSet(request.POST, request.FILES, instance=coordinator, prefix="input")
new_data_output_formset = NewDataOutputFormSet(
request.POST, request.FILES, instance=coordinator, prefix="output"
)
if (
coordinator_form.is_valid()
and dataset_formset.is_valid()
and data_input_formset.is_valid()
and data_output_formset.is_valid()
and new_data_input_formset.is_valid()
and new_data_output_formset.is_valid()
):
coordinator = coordinator_form.save()
dataset_formset.save()
data_input_formset.save()
data_output_formset.save()
new_data_input_formset.save()
new_data_output_formset.save()
request.info(_("Coordinator saved."))
return redirect(reverse("oozie:edit_coordinator", kwargs={"coordinator": coordinator.id}))
else:
coordinator_form = CoordinatorForm(instance=coordinator, user=request.user)
dataset_formset = DatasetFormSet(instance=coordinator)
data_input_formset = DataInputFormSet(instance=coordinator)
data_output_formset = DataOutputFormSet(instance=coordinator)
new_data_input_formset = NewDataInputFormSet(
queryset=DataInput.objects.none(), instance=coordinator, prefix="input"
)
new_data_output_formset = NewDataOutputFormSet(
queryset=DataOutput.objects.none(), instance=coordinator, prefix="output"
)
return render(
"editor/edit_coordinator.mako",
request,
{
"coordinator": coordinator,
"coordinator_form": coordinator_form,
"dataset_formset": dataset_formset,
"data_input_formset": data_input_formset,
"data_output_formset": data_output_formset,
"dataset": dataset,
"dataset_form": dataset_form,
"new_data_input_formset": new_data_input_formset,
"new_data_output_formset": new_data_output_formset,
"history": history,
},
)