Exemplo n.º 1
0
def teacher_add(request):
    if request.method == "POST":
        form = TeacherForm(request.POST)
        if form.is_valid():
            form.save()
            return render_to_response("common/success.html")
    else:
        form = TeacherForm()

    variables = RequestContext(request, {"form": form})
    return render_to_response("crud/teacher/teacher_add.html", variables)
Exemplo n.º 2
0
def teacher_edit(request, id):
    teacher = Teacher.objects.get(pk=id)
    if request.method == "POST":
        form = TeacherForm(request.POST, instance=teacher)
        if form.is_valid():
            form.save()
            return render_to_response("common/success.html")
    else:
        form = TeacherForm(instance=teacher)

    variables = RequestContext(request, {"form": form})

    return render_to_response("crud/teacher/teacher_edit.html", variables)
Exemplo n.º 3
0
def teacher_add(request):
    if request.method == 'POST':
        form = TeacherForm(request.POST)
        if form.is_valid():
            form.save()
            return render_to_response('common/success.html')
    else:
        form = TeacherForm()

    variables = RequestContext(request, {'form': form})
    return render_to_response('crud/teacher/teacher_add.html', variables)
Exemplo n.º 4
0
def teacher_edit(request, id):
    teacher = Teacher.objects.get(pk=id)
    if request.method == "POST":
        form = TeacherForm(request.POST, instance=teacher)
        if form.is_valid():
            form.save()
            return render_to_response('common/success.html')
    else:
        form = TeacherForm(instance=teacher)

    variables = RequestContext(request, {'form': form})

    return render_to_response("crud/teacher/teacher_edit.html", variables)