Reputation: 191
I am trying to use truncatechars in flask. When previously I used truncatechars in django the following code worked
The code (Django):
<div class="preview">{{post.content |safe| truncatechars:500}}</div>
But when I use truncatechars in flask it throws an error saying jinja2.exceptions.TemplateAssertionError: No filter named 'truncatechars_html'.
The code (Flask):
<div class="preview">{{post.content |safe| truncatechars(500)}}</div>
When I used ":" instead of brackets "()" it throwed an error saying jinja2.exceptions.TemplateSyntaxError: expected token 'end of print statement', got ':'
Upvotes: 0
Views: 267