Ejemplo n.º 1
0
def adiciona_emissaoecm(request):
	if request.method=='POST':
		form=FormFonteEmissaoECM(request.POST,request.FILES)
		if form.is_valid():
			form.save()
			return render_to_response('fatores/add_emissaoecm.html',{'form':form},context_instance=RequestContext(request))
	else:
		form=FormFonteEmissaoECM()				
	return render_to_response('fatores/add_emissaoecm.html',{'form':form},context_instance=RequestContext(request))
Ejemplo n.º 2
0
def edita_emissaoecm(request,nr_item):
	objeto=FonteEmissaoECM.objects.get(pk=nr_item)
	if request.method=='POST':
		form=FormFonteEmissaoECM(request.POST,instance=objeto)		
		if form.is_valid():
			form.save()
			return render_to_response('fatores/edita_emissaoecm.html',{'form':form},context_instance=RequestContext(request))
	else:
		form=FormFonteEmissaoECM(instance=objeto)
	return render_to_response('fatores/edita_emissaoecm.html',{'form':form},context_instance=RequestContext(request))