or
(other
)This evaluates to true if either the expression on the left or the
expression on the right are true. This is one of the few operators that
differs between Python and templates. In templates you have to use the
or
method whereas in Python have to use the |
operator.
<h3>Hotels or Apartments</h3> <ul> {% for item in this.children.filter( (F.type == 'hotel').or(F.type == 'apartment')) %} <li>{{ item.name }} ({{ item.type}})</li> {% endfor %} </ul>
def get_hotels_or_apartments(page): return page.children.filter( (F.type == 'hotel') | (F.type == 'apartment'))
Comments