Exemple #1
0
def adiciona_ef(request):
	if request.method=='POST':
		form=EfSetorForm(request.POST,request.FILES)
		if form.is_valid():
			form.save()
			return render_to_response('efsetor/adiciona_ef.html',{'form':form}, context_instance=RequestContext(request))
	else:
		form=EfSetorForm()		
	return render_to_response('efsetor/adiciona_ef.html',{'form':form}, context_instance=RequestContext(request) )
Exemple #2
0
def edita_ef(request,nr_item):
	objeto=EfSetor.objects.get(pk=nr_item)
	if request.method=='POST':
		form=EfSetorForm(request.POST,instance=objeto)		
		if form.is_valid():
			form.save()
			return render_to_response('efsetor/edita_ef.html',{'form':form},context_instance=RequestContext(request))
	else:
		form=EfSetorForm(instance=objeto)
	return render_to_response('efsetor/edita_ef.html',{'form':form},context_instance=RequestContext(request))