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.
This commit is contained in:
Baptiste Jonglez 2021-10-10 23:31:16 +02:00 committed by zorun
parent 7d9226745f
commit 421cfbe645

View file

@ -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"):