def adiciona_rac(request): if request.method == "POST": form = FormRAC(request.POST, request.FILES) if form.is_valid(): form.save() return render_to_response("rac/add_rac.html", {"form": form}, context_instance=RequestContext(request)) else: form = FormRAC() return render_to_response("rac/add_rac.html", {"form": form}, context_instance=RequestContext(request))
def edita_rac(request, nr_item): objeto = RAC.objects.get(pk=nr_item) if request.method == "POST": form = FormRAC(request.POST, instance=objeto) if form.is_valid(): form.save() return render_to_response("rac/edita_rac.html", {"form": form}, context_instance=RequestContext(request)) else: form = FormRAC(instance=objeto) return render_to_response("rac/edita_rac.html", {"form": form}, context_instance=RequestContext(request))