Example #1
0
def inicia_inventario(request):	
	if request.method=='POST':
		form=FormInventario(request.POST,request.FILES)
		if form.is_valid():
			form.save()
			return render_to_response('inventario/adiciona_inventario.html',{'form':form},context_instance=RequestContext(request))
	else:
		form=FormInventario()
	return render_to_response('inventario/adiciona_inventario.html',{'form':form}, context_instance=RequestContext(request))
Example #2
0
def edita_inventario(request,nr_item):
	objeto=Inventario.objects.get(pk=nr_item)
	if request.method=='POST':
		form=FormInventario(request.POST,instance=objeto)		
		if form.is_valid():
			form.save()
			return render_to_response('inventario/edita_inventario.html',{'form':form},context_instance=RequestContext(request))
	else:
		form=FormInventario(instance=objeto)
	return render_to_response('inventario/edita_inventario.html',{'form':form},context_instance=RequestContext(request))