From 94243b676a734a31edda012a91c5b5769606af33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Wed, 12 Aug 2020 21:14:51 +0800 Subject: [PATCH] Moved the dummy record creation of the new transaction forms from the view to the templates, reducing the complexity of the control logic in the view in the accounting application. --- .../templates/accounting/transaction_form-expense.html | 4 ++++ .../templates/accounting/transaction_form-income.html | 4 ++++ .../templates/accounting/transaction_form-transfer.html | 8 ++++++++ accounting/views.py | 2 -- 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/accounting/templates/accounting/transaction_form-expense.html b/accounting/templates/accounting/transaction_form-expense.html index e79b8e1..5301e16 100644 --- a/accounting/templates/accounting/transaction_form-expense.html +++ b/accounting/templates/accounting/transaction_form-expense.html @@ -76,6 +76,10 @@ First written: 2020/7/23 {% with record_type="debit" no=forloop.counter order=forloop.counter %} {% include "accounting/include/record_form-non-transfer.html" %} {% endwith %} + {% empty %} + {% with record_type="debit" no=1 order=1 %} + {% include "accounting/include/record_form-non-transfer.html" %} + {% endwith %} {% endfor %}