Removed now unused code

This commit is contained in:
Edgar P. Burkhart 2022-12-28 09:56:35 +01:00
parent e911cdcf6b
commit a48e34281f
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227

View file

@ -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