def itemGanho(request, nr_item): item = get_object_or_404(Ganho, pk=nr_item) form = FormGanho(request.POST or None, request.FILES or None, instance=item) if form.is_valid(): form.save() return redirect("/listaGanho/") return render(request, "item.html", {'form': form})
def adicionaGanho(request): form = FormGanho(request.POST or None, request.FILES or None) if form.is_valid(): form.save() return redirect("/") return render(request, "adicionaGanho.html", {'form': form})