From a48e34281f77f777a9f817c25ca79d72b57c37ad Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" Date: Wed, 28 Dec 2022 09:56:35 +0100 Subject: [PATCH] Removed now unused code --- nummi/main/views.py | 37 ------------------------------------- 1 file changed, 37 deletions(-) diff --git a/nummi/main/views.py b/nummi/main/views.py index 1191b15..f41a05f 100644 --- a/nummi/main/views.py +++ b/nummi/main/views.py @@ -55,43 +55,6 @@ class TransactionListView(LoginRequiredMixin, ListView): context_object_name = "transactions" -@login_required -def transaction(request, uuid=None): - _form = None - _inv_form = None - if request.method == "GET": - if uuid is None: - _transaction = Transaction() - else: - _transaction = get_object_or_404(Transaction, id=uuid) - elif request.method == "POST": - if request.POST["form"] == "transaction": - _transaction, _ = Transaction.objects.get_or_create(id=uuid) - _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) - _invoice = Invoice(transaction=_transaction) - _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, - "main/transaction.html", - { - "transaction": _transaction, - "form": _form or TransactionForm(instance=_transaction), - "invoice_form": _inv_form - or InvoiceForm(instance=Invoice(transaction=_transaction)), - }, - ) - - class TransactionCreateView(LoginRequiredMixin, CreateView): model = Transaction form_class = TransactionForm