Beispiel #1
0
def faculty_add(request):
    if request.method == 'POST':
        form = FacultyForm(request.POST)
        if form.is_valid():
            form.save()
            return render_to_response('common/success.html')
    else:
        form = FacultyForm()

    variables = RequestContext(request, {'form': form})
    return render_to_response('crud/faculty/faculty_add.html', variables)
Beispiel #2
0
def faculty_add(request):
    if request.method == "POST":
        form = FacultyForm(request.POST)
        if form.is_valid():
            form.save()
            return render_to_response("common/success.html")
    else:
        form = FacultyForm()

    variables = RequestContext(request, {"form": form})
    return render_to_response("crud/faculty/faculty_add.html", variables)
Beispiel #3
0
def faculty_edit(request, id):
    faculty = Faculty.objects.get(pk=id)
    if request.method == "POST":
        form = FacultyForm(request.POST, instance=faculty)
        if form.is_valid():
            form.save()
            return render_to_response('common/success.html')
    else:
        form = FacultyForm(instance=faculty)

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

    return render_to_response("crud/faculty/faculty_edit.html", variables)
Beispiel #4
0
def faculty_edit(request, id):
    faculty = Faculty.objects.get(pk=id)
    if request.method == "POST":
        form = FacultyForm(request.POST, instance=faculty)
        if form.is_valid():
            form.save()
            return render_to_response("common/success.html")
    else:
        form = FacultyForm(instance=faculty)

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

    return render_to_response("crud/faculty/faculty_edit.html", variables)