My web app created by Flask is using Jinja 2 template. I created my form from the request form value as below:
form = T3InputForm(request.form)
And defined my T3InputForm as:
class T3InputForm(Form):
savgp = StringField('Selected Averaging Period',
validators=[DataRequired()])
In my HTML file, I have
<div class="form-group col-md-6">
<p> <h4>{{ form.savgp.label}} : {{ form.savgp }} </h4></p>
</div>
So I can assign my input to the {{ form.savgp }} variable and pass it to my python function. Now, My question is that, How can I render a bootstrap list select box and assign the value of that to the form.savgp variable using Jinja 2 template:
To render a list select box using bootstrap I know this is the code lines:
<select class="form-control">
<option value="one">One</option>
<option value="two">Two</option>
<option value="three">Three</option>
<option value="four">Four</option>
<option value="five">Five</option>
</select>
How should assign those options for the {{ form.savgp }} variable? Please let me know if I can provide any further information to explain my issue better.
flask-wtf? ... use a SelectField instead of StringField? - Joran Beasley