Ejemplo n.º 1
0
def adiciona_ced(request):
	if request.method=='POST':
		form=FormCED(request.POST,request.FILES)
		if form.is_valid():
			form.save()
			return render_to_response('ced/add_ced.html',{'form':form},context_instance=RequestContext(request))
	else:
		form = FormCED()
	return render_to_response('ced/add_ced.html',{'form':form},context_instance=RequestContext(request))
Ejemplo n.º 2
0
def edita_ced(request,nr_item):
	objeto=CED.objects.get(pk=nr_item)
	if request.method=='POST':
		form=FormCED(request.POST,instance=objeto)		
		if form.is_valid():
			form.save()
			return render_to_response('ced/edita_ced.html',{'form':form},context_instance=RequestContext(request))
	else:
		form=FormCED(instance=objeto)
	return render_to_response('ced/edita_ced.html',{'form':form},context_instance=RequestContext(request))