def adiciona_ece(request): if request.method=='POST': form=FormECE(request.POST,request.FILES) if form.is_valid(): form.save() return render_to_response('ece/add_ece.html',{'form':form},context_instance=RequestContext(request)) else: form=FormECE() return render_to_response('ece/add_ece.html',{'form':form},context_instance=RequestContext(request))
def edita_ece(request,nr_item): objeto=ECE.objects.get(pk=nr_item) if request.method=='POST': form=FormECE(request.POST,instance=objeto) if form.is_valid(): form.save() return render_to_response('ece/edita_ece.html',{'form':form},context_instance=RequestContext(request)) else: form=FormECE(instance=objeto) return render_to_response('ece/edita_ece.html',{'form':form},context_instance=RequestContext(request))