From a3d4e4250d17dbd56fdaa53f4dec448e3970f9f7 Mon Sep 17 00:00:00 2001 From: Timo Riski Date: Sat, 23 Mar 2024 16:49:42 +0200 Subject: [PATCH] fix: 'Bill Type: Invalid Choice: could not coerce' error Error introduced in #1290. Fixes #1293. WTForms needs to be bumped to >=2.3.2 as it includes a fix to `SelectField` which is required for this change to work. See: - https://wtforms.readthedocs.io/en/3.1.x/changes/#version-2-3-2 - https://github.com/wtforms/wtforms/pull/598 --- ihatemoney/models.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ihatemoney/models.py b/ihatemoney/models.py index c7dee1856..3272cf41c 100644 --- a/ihatemoney/models.py +++ b/ihatemoney/models.py @@ -58,7 +58,7 @@ class BillType(Enum): @classmethod def choices(cls): - return [(choice, choice.value) for choice in cls] + return [(choice.value, choice.value) for choice in cls] db = SQLAlchemy() diff --git a/pyproject.toml b/pyproject.toml index cc6199a0d..ee8ad57bc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,7 +39,7 @@ dependencies = [ "Flask-SQLAlchemy>=2.4,<3", "Flask-Talisman>=0.8,<2", "Flask-WTF>=0.14.3,<2", - "WTForms>=2.3.1,<3.2", + "WTForms>=2.3.3,<3.2", "Flask>=2,<3", "Werkzeug>=2,<3", "itsdangerous>=2,<3",