Use jinja2 |length filter