Ejemplo n.º 1
0
def job_crontab_edit(request, ids):
    status = 0
    obj = get_object(CrontabSchedule, id=ids)

    if request.method == 'POST':
        form = CrontabForm(request.POST, instance=obj)
        if form.is_valid():
            form.save()
            status = 1
        else:
            status = 2
    else:
        form = CrontabForm(instance=obj)

    return render(request, 'setup/crontab_edit.html', locals())
Ejemplo n.º 2
0
def job_crontab_add(request):
    temp_name = "setup/setup-header.html"
    if request.method == "POST":
        a_form = CrontabForm(request.POST)
        if a_form.is_valid():
            a_form.save()
            tips = u"增加成功!"
            display_control = ""
            return redirect("/setup/job/crontab/list/")
        else:
            tips = u"增加失败!"
            display_control = ""
            return render(request, "setup/crontab_add.html", locals())
    else:
        display_control = "none"
        a_form = CrontabForm()
        return render(request, "setup/crontab_add.html", locals())