示例#1
0
文件: views.py 项目: danribeiro/sigee
def adiciona_fonte(request):
	if request.method=='POST':
		form=FonteForm(request.POST,request.FILES)	
		if form.is_valid():
			form.save()			
			return render_to_response('fonte_emissao/adiciona_fonte.html',{'form':form},context_instance=RequestContext(request))
	else:
		form=FonteForm()		
	return render_to_response('fonte_emissao/adiciona_fonte.html',{'form':form},context_instance=RequestContext(request))
示例#2
0
文件: views.py 项目: danribeiro/sigee
def edita_fonte(request,nr_item):
	objeto=FonteEmissao.objects.get(pk=nr_item)
	if request.method=='POST':
		form=FonteForm(request.POST,instance=objeto)		
		if form.is_valid():
			form.save()
			return render_to_response('fonte_emissao/edita_fonte.html',{'form':form},context_instance=RequestContext(request))
	else:
		form=FonteForm(instance=objeto)
	return render_to_response('fonte_emissao/edita_fonte.html',{'form':form},context_instance=RequestContext(request))