mirror of
https://github.com/spiral-project/ihatemoney.git
synced 2025-05-06 13:01:50 +02:00
move choices generation in constructor to fix i18n
In a class field, we don't have access to the current locale
This commit is contained in:
parent
37a5c427db
commit
d3e3cd418d
1 changed files with 7 additions and 4 deletions
|
@ -109,13 +109,16 @@ class EditProjectForm(FlaskForm):
|
||||||
currency_helper = CurrencyConverter()
|
currency_helper = CurrencyConverter()
|
||||||
default_currency = SelectField(
|
default_currency = SelectField(
|
||||||
_("Default Currency"),
|
_("Default Currency"),
|
||||||
choices=[
|
|
||||||
(currency_name, render_localized_currency(currency_name))
|
|
||||||
for currency_name in currency_helper.get_currencies()
|
|
||||||
],
|
|
||||||
validators=[DataRequired()],
|
validators=[DataRequired()],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
self.default_currency.choices = [
|
||||||
|
(currency_name, render_localized_currency(currency_name, detailed=True))
|
||||||
|
for currency_name in self.currency_helper.get_currencies()
|
||||||
|
]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def logging_preference(self):
|
def logging_preference(self):
|
||||||
"""Get the LoggingMode object corresponding to current form data."""
|
"""Get the LoggingMode object corresponding to current form data."""
|
||||||
|
|
Loading…
Reference in a new issue