Esempio n. 1
0
def adiciona_ecm(request):
	if request.method=='POST':
		form=FormECM(request.POST,request.FILES)
		if form.is_valid():
			form.save()
			return render_to_response('ecm/add_ecm.html',{'form':form},context_instance=RequestContext(request))
	else:
		form=FormECM()				
	return render_to_response('ecm/add_ecm.html',{'form':form},context_instance=RequestContext(request))
Esempio n. 2
0
def edita_ecm(request,nr_item):
	objeto=ECM.objects.get(pk=nr_item)
	if request.method=='POST':
		form=FormECM(request.POST,instance=objeto)		
		if form.is_valid():
			form.save()
			return render_to_response('ecm/edita_ecm.html',{'form':form},context_instance=RequestContext(request))
	else:
		form=FormECM(instance=objeto)
	return render_to_response('ecm/edita_ecm.html',{'form':form},context_instance=RequestContext(request))