def adiciona_ecv(request): if request.method == "POST": form = FormECV(request.POST, request.FILES) if form.is_valid(): form.save() return render_to_response("ecv/add_ecv.html", {"form": form}, context_instance=RequestContext(request)) else: form = FormECV() return render_to_response("ecv/add_ecv.html", {"form": form}, context_instance=RequestContext(request))
def edita_ecv(request, nr_item): objeto = ECV.objects.get(pk=nr_item) if request.method == "POST": form = FormECV(request.POST, instance=objeto) if form.is_valid(): form.save() return render_to_response("ecv/edita_ecv.html", {"form": form}, context_instance=RequestContext(request)) else: form = FormECV(instance=objeto) return render_to_response("ecv/edita_ecv.html", {"form": form}, context_instance=RequestContext(request))