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))
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))