I need to add default option value to a select field using Jinja templates.
form.py
class TeamForm(Form):
user = SelectField(u'Team Member')
views.py
class myview(request,id):
form = TeamForm(request.form)
members =db.session.query(teams).filter_by(t_id = id).all()
return render_template("members.html",form=form,members=members)
member.html
<table>
{% for member in members%}
<tr>
<td>{{ form.user(class_="form-control",value=user.id) }}</td>
</tr>
{% endfor %}
</table>
The assigned option value is not shown in the output.
I have to loop the select fields depending upon the members in team. For example, if a team has 3 members, I will display the three select fields and auto select those three members.