What is the correct way to populate select choices from session data?
问题 I'm storing some variables in the session when the user logs in, to use later to populate a field. from flask_wtf import Form from wtforms import SelectField from flask import session class InstitutionForm(Form): city = session['city'] city_tuples = [(x, x) for x in city] organisation = SelectField( 'organisation', choices=city_tuples ) class Institution(View): methods = ['POST'] def dispatch_request(self): form = InstitutionForm() return render_template( 'form/institution.html', form=form)