Fix the label of the EnumField field type
If there are no translations provided, use the enum name
This commit is contained in:
parent
64c72b1a68
commit
41b4b9d7ea
@ -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):
|
||||||
|
Loading…
Reference in New Issue
Block a user