예제 #1
0
파일: views.py 프로젝트: danribeiro/sigee
def adiciona_fonterac(request):
    if request.method == "POST":
        form = FormFonteRAC(request.POST, request.FILES)
        if form.is_valid():
            form.save()
            return render_to_response(
                "fonterac/add_fonterac.html", {"form": form}, context_instance=RequestContext(request)
            )
    else:
        form = FormFonteRAC()
    return render_to_response("fonterac/add_fonterac.html", {"form": form}, context_instance=RequestContext(request))
예제 #2
0
파일: views.py 프로젝트: danribeiro/sigee
def edita_fonterac(request, nr_item):
    objeto = FonteRAC.objects.get(pk=nr_item)
    if request.method == "POST":
        form = FormFonteRAC(request.POST, instance=objeto)
        if form.is_valid():
            form.save()
            return render_to_response(
                "fonterac/edita_fonterac.html", {"form": form}, context_instance=RequestContext(request)
            )
    else:
        form = FormFonteRAC(instance=objeto)
    return render_to_response("fonterac/edita_fonterac.html", {"form": form}, context_instance=RequestContext(request))