Example #1
0
def adiciona_fonteCED(request):
	if request.method=='POST':		
		form=FormFonteCED(request.POST)
		if form.is_valid():
			form.save()
			return render_to_response('fonteced/add_FonteCED.html',{'form':form},context_instance=RequestContext(request))
	else:
		form=FormFonteCED()
	return render_to_response('fonteced/add_FonteCED.html',{'form':form},context_instance=RequestContext(request))
Example #2
0
def edita_fonteCED(request,nr_item):
	objeto=FonteCED.objects.get(pk=nr_item)
	if request.method=='POST':
		form=FormFonteCED(request.POST,instance=objeto)		
		if form.is_valid():
			form.save()
			return render_to_response('fonteced/edita_fonteCED.html',{'form':form},context_instance=RequestContext(request))
	else:
		form=FormFonteCED(instance=objeto)
	return render_to_response('fonteced/edita_fonteCED.html',{'form':form},context_instance=RequestContext(request))