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

    variables = RequestContext(request, {'form': form})
    return render_to_response('crud/department/department_add.html', variables)
Example #2
0
def department_add(request):
    if request.method == "POST":
        form = DepartmentForm(request.POST)
        if form.is_valid():
            form.save()
            return render_to_response("common/success.html")
    else:
        form = DepartmentForm()

    variables = RequestContext(request, {"form": form})
    return render_to_response("crud/department/department_add.html", variables)
Example #3
0
def department_edit(request, id):
    department = Department.objects.get(pk=id)
    if request.method == "POST":
        form = DepartmentForm(request.POST, instance=department)
        if form.is_valid():
            form.save()
            return render_to_response('common/success.html')
    else:
        form = DepartmentForm(instance=department)

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

    return render_to_response("crud/book/department_edit.html", variables)
Example #4
0
def department_edit(request, id):
    department = Department.objects.get(pk=id)
    if request.method == "POST":
        form = DepartmentForm(request.POST, instance=department)
        if form.is_valid():
            form.save()
            return render_to_response("common/success.html")
    else:
        form = DepartmentForm(instance=department)

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

    return render_to_response("crud/book/department_edit.html", variables)