In my opinion it's better to define the form not in the template but in the controller.
Example form definition :
class CommentForm(Form):
language = SelectField(u'What You Want', choices=CAN_BE_FILLED_LATER_ON)
code = TextAreaField()
All you need later on is to -
Initialize the form by:
comment_form = CommentForm()
Passing it to the template:
return render_template('post_show.jinja2.html', comment_form=comment_form)
Render the form in the template:
<div class="form-group" id='cg-{{comment_form.email.id}}'> {{comment_form.email.label(class='col-lg-2 control-label',for=comment_form.email.id)}} <div class="col-lg-9"> {{comment_form.email(class='form-control')}} <span class="help-block" id='hl-{{comment_form.email.id}}'></span> </div> </div