Revised to use its own error message for the DataRequired validator in the default_currency field of the OptionForm form.

This commit is contained in:
依瑪貓 2023-03-22 19:12:38 +08:00
parent f9c39709c8
commit 2014344d25

View File

@ -24,7 +24,7 @@ from flask_wtf import FlaskForm
from wtforms import StringField, FieldList, FormField, IntegerField from wtforms import StringField, FieldList, FormField, IntegerField
from wtforms.validators import DataRequired, ValidationError from wtforms.validators import DataRequired, ValidationError
from accounting.forms import CURRENCY_REQUIRED, CurrencyExists from accounting.forms import CurrencyExists
from accounting.locale import lazy_gettext from accounting.locale import lazy_gettext
from accounting.models import Account from accounting.models import Account
from accounting.utils.current_account import CurrentAccount, current_accounts from accounting.utils.current_account import CurrentAccount, current_accounts
@ -235,8 +235,9 @@ class OptionForm(FlaskForm):
"""The form to update the options.""" """The form to update the options."""
default_currency = StringField( default_currency = StringField(
filters=[strip_text], filters=[strip_text],
validators=[CURRENCY_REQUIRED, validators=[
CurrencyExists()]) DataRequired(lazy_gettext("Please select the default currency.")),
CurrencyExists()])
"""The default currency code.""" """The default currency code."""
default_ie_account_code = StringField( default_ie_account_code = StringField(
filters=[strip_text], filters=[strip_text],