Example #1
0
def adiciona_fator(request):
	#FatorFormSet=inlineformset_factory(FatoresVariaveis,Parametros)
	if request.method=='POST':
		form=FormFatores(request.POST,request.FILES)
		if form.is_valid():
			form.save()
			return render_to_response('fatores/add_fator.html',{'form':form},context_instance=RequestContext(request))
	else:
		form=FormFatores()				
	return render_to_response('fatores/add_fator.html',{'form':form},context_instance=RequestContext(request))
Example #2
0
def edita_fator(request,nr_item):
	objeto=FatoresVariaveis.objects.get(pk=nr_item)
	if request.method=='POST':
		form=FormFatores(request.POST,instance=objeto)		
		if form.is_valid():
			form.save()
			return render_to_response('fatores/edita_fator.html',{'form':form},context_instance=RequestContext(request))
	else:
		form=FormFatores(instance=objeto)
	return render_to_response('fatores/edita_fator.html',{'form':form},context_instance=RequestContext(request))