def adiciona_fonteece(request): if request.method=='POST': form=FormFonteECE(request.POST,request.FILES) if form.is_valid(): form.save() return render_to_response('fonteece/add_fonteece.html',{'form':form},context_instance=RequestContext(request)) else: form=FormFonteECE() return render_to_response('fonteece/add_fonteece.html',{'form':form},context_instance=RequestContext(request))
def edita_fonteece(request,nr_item): objeto=FonteECE.objects.get(pk=nr_item) if request.method=='POST': form=FormFonteECE(request.POST,instance=objeto) if form.is_valid(): form.save() return render_to_response('fonteece/edita_fonteece.html',{'form':form},context_instance=RequestContext(request)) else: form=FormFonteECE(instance=objeto) return render_to_response('fonteece/edita_fonteece.html',{'form':form},context_instance=RequestContext(request))