Fix the label of the EnumField field type

If there are no translations provided, use the enum name
This commit is contained in:
Gergely Polonkai 2018-07-16 13:32:22 +02:00
parent 64c72b1a68
commit 41b4b9d7ea

View File

@ -192,13 +192,9 @@ class EnumField(SelectField):
def iter_choices(self): def iter_choices(self):
for value in self.enum_type: 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 ( yield (value.name, label, value == self.data)
value.name,
self.gettext(self.translations[value]),
value == self.data
)
class EventForm(FlaskForm): class EventForm(FlaskForm):