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
1 changed files with 2 additions and 6 deletions

View File

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