I have a WTF SelectField, and I'm trying to store the name of the user's choice for display on another page.
Given that my form is
choice = SelectField('Choice', choices=[('cho_1', 'Choice One'), ('cho2', 'Choice Two')])
I understand that
self.choice = form.choice.data
will get me the user's choice (say, cho_1), but how do I get the value ("Choice One")? I feel like it's something simple with dicts, but various attempts plus googling/searching SO haven't helped so far.
value = dict(form.choice.choices).get(int(form.choice.data))
– Praiseworthy