mirror of
https://github.com/spiral-project/ihatemoney.git
synced 2025-05-06 05:01:48 +02:00
only populate billform currencies after creation
we can translate correctly, and exclude no_currency as needed
This commit is contained in:
parent
e2159b52a6
commit
37a5c427db
1 changed files with 8 additions and 14 deletions
|
@ -47,13 +47,14 @@ def get_billform_for(project, set_default=True, **kwargs):
|
|||
if form.original_currency.data == "None":
|
||||
form.original_currency.data = project.default_currency
|
||||
|
||||
if form.original_currency.data != CurrencyConverter.no_currency:
|
||||
form.original_currency.choices.remove(
|
||||
(
|
||||
CurrencyConverter.no_currency,
|
||||
render_localized_currency(CurrencyConverter.no_currency, detailed=False),
|
||||
)
|
||||
show_no_currency = form.original_currency.data == CurrencyConverter.no_currency
|
||||
|
||||
form.original_currency.choices = [
|
||||
(currency_name, render_localized_currency(currency_name, detailed=False))
|
||||
for currency_name in form.currency_helper.get_currencies(
|
||||
with_no_currency=show_no_currency
|
||||
)
|
||||
]
|
||||
|
||||
active_members = [(m.id, m.name) for m in project.active_members]
|
||||
|
||||
|
@ -227,14 +228,7 @@ class BillForm(FlaskForm):
|
|||
payer = SelectField(_("Payer"), validators=[DataRequired()], coerce=int)
|
||||
amount = CalculatorStringField(_("Amount paid"), validators=[DataRequired()])
|
||||
currency_helper = CurrencyConverter()
|
||||
original_currency = SelectField(
|
||||
_("Currency"),
|
||||
choices=[
|
||||
(currency_name, render_localized_currency(currency_name, detailed=False))
|
||||
for currency_name in currency_helper.get_currencies()
|
||||
],
|
||||
validators=[DataRequired()],
|
||||
)
|
||||
original_currency = SelectField(_("Currency"), validators=[DataRequired()],)
|
||||
external_link = URLField(
|
||||
_("External link"),
|
||||
validators=[Optional()],
|
||||
|
|
Loading…
Reference in a new issue