From d8b00d91e8d192a96b4b43c3730f3124537bacb5 Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" Date: Wed, 21 Dec 2022 15:49:27 +0100 Subject: [PATCH] Redirect on valid form input --- nummi/main/views.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nummi/main/views.py b/nummi/main/views.py index e237547..74b5359 100644 --- a/nummi/main/views.py +++ b/nummi/main/views.py @@ -64,6 +64,7 @@ def transaction(request, uuid=None): _form = TransactionForm(request.POST, instance=_transaction) if _form.is_valid(): _form.save() + return redirect(transaction, uuid=uuid) _inv_form = InvoiceForm(instance=Invoice(transaction=_transaction)) elif request.POST["form"] == "invoice": _transaction = get_object_or_404(Transaction, id=uuid) @@ -71,6 +72,7 @@ def transaction(request, uuid=None): _inv_form = InvoiceForm(request.POST, request.FILES, instance=_invoice) if _inv_form.is_valid(): _inv_form.save() + return redirect(transaction, uuid=uuid) return render( request, @@ -118,6 +120,7 @@ def category(request, uuid=None): _form = CategoryForm(request.POST, instance=_category) if _form.is_valid(): _form.save() + return redirect(category, uuid=uuid) return render( request,