title: Python Jinja2 filtering
body: <p>if my table is like this</p>
  <p><img src="https://i.stack.imgur.com/dRpeq.png" alt="snippet" /></p>
  <p>how can I output the number of events with the same name, like test should be 5 and hello should be 3.</p>
  <p>Edit:
  Here's my Jinja2 code snippet</p>
  <pre><code>        {% for event in events %}
              {% set count = 0 %}
              &lt;tr&gt;
                  &lt;td&gt;{{ event.name }}&lt;/td&gt;
                  {% for ticket in tickets %}
                      {% if ticket.event_name == event.name%}
                          {% set count = count + 1 %}
                      {% endif %}
         
                  {% endfor %}
                  &lt;td&gt;{{count}}&lt;td&gt;
                  &lt;td&gt;
  </code></pre>
  <p>But its not counting right</p>