Reputation: 20150
I'm getting a problem while comparing two string in python:
this is working:
{% for publication in publications %}
{{ publications[publication].pub_type }}
{% endfor %}
but not this:
{% for publication in publications %}
{% if publications[publication].pub_type equals "conference_paper" %}
class="active"
{% endif %}
{% endfor %}
In the above code, I'm just testing something, but its not working
I'm getting this error:
jinja2.exceptions.TemplateSyntaxError
TemplateSyntaxError: expected token 'end of statement block', got 'equals'
Upvotes: 13
Views: 27267
Reputation: 156188
perhaps you want:
{% if publication.pub_type == "conference_paper" %}
{# ^^ #}
equals
is not valid jinja2 syntax
Upvotes: 31