I have a template(test.html) as follows:
{% extends 'base.html' %}
{% from "_formhelpers.html" import render_field %}
{% block content %}
<div class="container">
<div class="row">
<div class="span6 offset3">
<form class="form-horizontal" action="/create_user/" method="post">
{{ form.csrf_token }}
<dl>
{{ render_field(form.name) }}
{{ render_field(form.members) }}
<!--<div class="control-group">
<label class="control-label">
{{ form.task.label }}
</label>
<div class='controls'>
{{ form.task}}
{% if form.task.errors %}
<ul class="text-error">
{% for error in form.task.errors %}
<li>{{ error }}</li>
{% endfor %}
</ul>
{% endif %}
</div>
</div>-->
</dl>
</form>
</div>
</div>
</div>
{% endblock %}
When rendering this template using Flask's render_template("test.html", form=form). I got following error "UndefinedError: 'tickapp.forms.TeamForm object' has no attribute 'task'". As you can see I have commented out 'form.task' in the template(whole ) and also there is no such field in models and in my form.
I wonder why jinja2 is considering commented html content. I trusted comments(!) and spent couple of hours on this issue. Finally, deleted all the comments and it started working.Anybody working in jinja2 faced this problem? and do you know why it is happening?