I'm new to Python and Django, and have the following line of code in an html template:
{% if len(dato.titulo) > 35 %} {{dato.titulo[:35] + '...'}} {% else %} {{ dato.titulo }}{% endif %}
the {% if len(dato.titulo) > 35 %}
bit throws the exception. I tried using a truncatechars filter but the django version installed is apparently old and doesn't have the filter. How could I make this work (truncate the string if it has more than 35 characters)?