示例#1
0
文件: views.py 项目: danribeiro/sigee
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))
示例#2
0
文件: views.py 项目: danribeiro/sigee
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))