jinja2 error: jinja2.exceptions.Templatesyntaxerror: Unexpected '%'

Asked

Viewed 48 times

0

My code is generating a " Unexpected '%' error", all symbols being properly correct.

I have a route to show the companies Cnpjs in a list, follows function of the listing below:

@app.route("/list/company")
def listCompany():
    companies = Company.query.all()

    return render_template("listCompany.html", companies = companies)

Below is the HTML section of the listing page.

<table>
    <tr>
        <td>ID</td>
        <td>Nome</td>
    </tr>
    {{% for companie in companies %}}
    <tr>
        <td> {{ companies._id }} </td>
        <td> {{ companies.cnpj }} </td>
    </tr>
    {{% endfor %}}
</table>

This code gives me the error:

jinja2.exceptions.Templatesyntaxerror: Unexpected '%'

1 answer

2


The tags for, are wrong.

{% for companie in companies %}
...
{% endfor %}
  • Thank you very much!!!!!!!!

  • For nothing! ;-) It really happens, sometimes goes unnoticed.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.