Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {% if {{myarr|length}} > 1 %}
- <!-- printing some html here -->
- {% endif %}
- from django import template
- register = template.Library()
- def length_gt(value, arg):
- """Returns a boolean of whether the value is greater than an argument."""
- try:
- return len(value) > int(arg)
- except (ValueError, TypeError):
- return ''
- length_gt.is_safe = False
- register.filter(length_gt)
- {% if myarr|length > 1 %}
- <!-- printing some html here -->
- {% endif %}
Add Comment
Please, Sign In to add comment