title: How to use pipe in Flask/Jinja template differently than filters?
body: <p>I'm using <a href="http://flask.pocoo.org" rel="nofollow">Flask</a> with the <a href="http://jinja.pocoo.org" rel="nofollow">Jinja2 templating engine</a> to build a website. As an ORM I use the (excellent) <a href="http://docs.peewee-orm.com/en/latest/" rel="nofollow">Peewee ORM</a> and I now run into a problem. </p>
  
  <p>In my Flask view I get a list of users from the DB:</p>
  
  <pre><code>@app.route('/stats')
  def stats():
      users = User.select()
      return render_template('stats.html', users=users)
  </code></pre>
  
  <p>and in my template I loop over the users and try to expand the query. This works:</p>
  
  <pre><code>{% for user in users %}
      {{ user.app_logs.where(AppLog.type == 'LOGIN').first().created }}
  {% endfor %}
  </code></pre>
  
  <p>but this:</p>
  
  <pre><code>{% for user in users %}
      {{ user.app_logs.where((AppLog.type == 'LOGIN') | (AppLog.type == AppLog.TICKET)).first().created }}
  {% endfor %}
  </code></pre>
  
  <p>gives a <code>TemplateSyntaxError: expected token 'name', got '('</code>. I understand what the error comes from: the pipe symbol (<code>|</code>) is defined as <a href="http://jinja.pocoo.org/docs/dev/templates/#filters" rel="nofollow">a filter in Jinja</a>. So I tried escaping it with a backslash (<code>\|</code>) but that doesn't work.</p>
  
  <p>So my question: is there a way to somehow escape the pipe symbol or does anybody have any other idea to make this work? All tips are welcome!</p>