Example #1
0
def adicionaTipoDespesa(request):
	form = FormTipoDespesa(request.POST or None, request.FILES or None)
	
	if form.is_valid():
		form.save()
		return redirect("/")
	
	return render(request, "adicionaTipoDespesa.html", {'form': form})
Example #2
0
def itemTipoDespesa(request, nr_item):
	item = get_object_or_404(TipoDespesa, pk=nr_item)
	form = FormTipoDespesa(request.POST or None, request.FILES or None, instance=item)

	if form.is_valid():
		form.save()
		return redirect("/listaTipoDespesa/")
	return render(request, "item.html", {'form': form})