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))
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))
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))