From 421cfbe64555c9c09dae97c93eacdde75585b6a8 Mon Sep 17 00:00:00 2001 From: Baptiste Jonglez Date: Sun, 10 Oct 2021 23:31:16 +0200 Subject: [PATCH] project: set XXX as default default_currency for API backwards compatibility The new support for currency broke backwards compatibility on the API: $ curl -X POST $URL/api/projects -d 'name=yay&id=yay&password=yay&contact_email=yay@notmyidea.org' {"default_currency": ["This field is required."]} This is a case we were not testing (will be fixed in subsequent commits) To fix this, simply set default_currency to XXX by default. --- ihatemoney/forms.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ihatemoney/forms.py b/ihatemoney/forms.py index 3bbe34a5..7839a5d9 100644 --- a/ihatemoney/forms.py +++ b/ihatemoney/forms.py @@ -113,7 +113,11 @@ class EditProjectForm(FlaskForm): project_history = BooleanField(_("Enable project history")) ip_recording = BooleanField(_("Use IP tracking for project history")) currency_helper = CurrencyConverter() - default_currency = SelectField(_("Default Currency"), validators=[DataRequired()]) + default_currency = SelectField( + _("Default Currency"), + validators=[DataRequired()], + default=CurrencyConverter.no_currency, + ) def __init__(self, *args, **kwargs): if not hasattr(self, "id"):