From 41b4b9d7ea36e998cf098743721933dc0b00253b Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Mon, 16 Jul 2018 13:32:22 +0200 Subject: [PATCH] Fix the label of the EnumField field type If there are no translations provided, use the enum name --- calsocial/forms.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/calsocial/forms.py b/calsocial/forms.py index 846715e..6d6e631 100644 --- a/calsocial/forms.py +++ b/calsocial/forms.py @@ -192,13 +192,9 @@ class EnumField(SelectField): def iter_choices(self): for value in self.enum_type: - label = self.translations[value] if self.translations else value.name + label = self.gettext(self.translations[value]) if self.translations else value.name - yield ( - value.name, - self.gettext(self.translations[value]), - value == self.data - ) + yield (value.name, label, value == self.data) class EventForm(FlaskForm):