I have the following loop in my jinja2 template
{% for item in list if item.author == 'bob' %}
I am trying to get the first 5 elements that have bob as the author.
I tried to do
{% for item in list if item.author == 'bob' and loop.index <= 5 %}
but he returned an undefined error.
How to make it work?
source
share