コード例 #1
0
ファイル: views.py プロジェクト: sholokhova/gecko2
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)
コード例 #2
0
ファイル: views.py プロジェクト: sholokhova/gecko2
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)
コード例 #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)
コード例 #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)