Changed the date field of the transaction forms to set the default value in the view, but not the form, so that the default value is not set when it did not receive a value.
This commit is contained in:
parent
bfb08cf5fc
commit
8d126e183f
@ -574,7 +574,8 @@ class IncomeCurrencyForm(CurrencyForm):
|
|||||||
|
|
||||||
class IncomeTransactionForm(TransactionForm):
|
class IncomeTransactionForm(TransactionForm):
|
||||||
"""The form to create or edit a cash income transaction."""
|
"""The form to create or edit a cash income transaction."""
|
||||||
date = DateField(default=date.today())
|
date = DateField(
|
||||||
|
validators=[DataRequired(lazy_gettext("Please fill in the date."))])
|
||||||
"""The date."""
|
"""The date."""
|
||||||
currencies = FieldList(FormField(IncomeCurrencyForm), name="currency",
|
currencies = FieldList(FormField(IncomeCurrencyForm), name="currency",
|
||||||
validators=[NeedSomeCurrencies()])
|
validators=[NeedSomeCurrencies()])
|
||||||
@ -647,7 +648,8 @@ class ExpenseCurrencyForm(CurrencyForm):
|
|||||||
|
|
||||||
class ExpenseTransactionForm(TransactionForm):
|
class ExpenseTransactionForm(TransactionForm):
|
||||||
"""The form to create or edit a cash expense transaction."""
|
"""The form to create or edit a cash expense transaction."""
|
||||||
date = DateField(default=date.today())
|
date = DateField(
|
||||||
|
validators=[DataRequired(lazy_gettext("Please fill in the date."))])
|
||||||
"""The date."""
|
"""The date."""
|
||||||
currencies = FieldList(FormField(ExpenseCurrencyForm), name="currency",
|
currencies = FieldList(FormField(ExpenseCurrencyForm), name="currency",
|
||||||
validators=[NeedSomeCurrencies()])
|
validators=[NeedSomeCurrencies()])
|
||||||
@ -756,7 +758,8 @@ class TransferCurrencyForm(CurrencyForm):
|
|||||||
|
|
||||||
class TransferTransactionForm(TransactionForm):
|
class TransferTransactionForm(TransactionForm):
|
||||||
"""The form to create or edit a transfer transaction."""
|
"""The form to create or edit a transfer transaction."""
|
||||||
date = DateField(default=date.today())
|
date = DateField(
|
||||||
|
validators=[DataRequired(lazy_gettext("Please fill in the date."))])
|
||||||
"""The date."""
|
"""The date."""
|
||||||
currencies = FieldList(FormField(TransferCurrencyForm), name="currency",
|
currencies = FieldList(FormField(TransferCurrencyForm), name="currency",
|
||||||
validators=[NeedSomeCurrencies()])
|
validators=[NeedSomeCurrencies()])
|
||||||
|
@ -79,6 +79,7 @@ def show_add_transaction_form(txn_type: TransactionType) -> str:
|
|||||||
form.validate()
|
form.validate()
|
||||||
else:
|
else:
|
||||||
form = txn_op.form()
|
form = txn_op.form()
|
||||||
|
form.date.data = date.today()
|
||||||
return txn_op.render_create_template(form)
|
return txn_op.render_create_template(form)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user