Exemple #1
0
def adiciona_fonteecv(request):
    if request.method == "POST":
        form = FormFonteECV(request.POST, request.FILES)
        if form.is_valid():
            form.save()
            return render_to_response(
                "fonteecv/add_fonteecv.html", {"form": form}, context_instance=RequestContext(request)
            )
    else:
        form = FormFonteECV()
    return render_to_response("fonteecv/add_fonteecv.html", {"form": form}, context_instance=RequestContext(request))
Exemple #2
0
def edita_fonteecv(request, nr_item):
    objeto = FonteECV.objects.get(pk=nr_item)
    if request.method == "POST":
        form = FormFonteECV(request.POST, instance=objeto)
        if form.is_valid():
            form.save()
            return render_to_response(
                "fonteecv/edita_fonteecv.html", {"form": form}, context_instance=RequestContext(request)
            )
    else:
        form = FormFonteECV(instance=objeto)
    return render_to_response("fonteecv/edita_fonteecv.html", {"form": form}, context_instance=RequestContext(request))