コード例 #1
0
ファイル: views.py プロジェクト: pombredanne/EvaP
def semester_create(request):
    form = SemesterForm(request.POST or None)

    if form.is_valid():
        semester = form.save()

        messages.success(request, _("Successfully created semester."))
        return redirect("staff:semester_view", semester.id)
    else:
        return render(request, "staff_semester_form.html", dict(form=form))
コード例 #2
0
def semester_create(request):
    form = SemesterForm(request.POST or None)

    if form.is_valid():
        semester = form.save()

        messages.success(request, _("Successfully created semester."))
        return redirect('staff:semester_view', semester.id)
    else:
        return render(request, "staff_semester_form.html", dict(form=form))
コード例 #3
0
ファイル: views.py プロジェクト: Paul-Geppert/EvaP
def semester_edit(request, semester_id):
    semester = get_object_or_404(Semester, id=semester_id)
    form = SemesterForm(request.POST or None, instance=semester)

    if form.is_valid():
        semester = form.save()

        messages.success(request, _("Successfully updated semester."))
        return redirect('staff:semester_view', semester.id)
    else:
        return render(request, "staff_semester_form.html", dict(semester=semester, form=form))
コード例 #4
0
ファイル: views.py プロジェクト: lmm-git/EvaP
def semester_edit(request, semester_id):
    semester = get_object_or_404(Semester, id=semester_id)
    form = SemesterForm(request.POST or None, instance=semester)

    if form.is_valid():
        semester = form.save()

        messages.success(request, _("Successfully updated semester."))
        return redirect('staff:semester_view', semester.id)
    else:
        return render(request, "staff_semester_form.html",
                      dict(semester=semester, form=form))