Truncates a value to n
characters and appends an ellipsis (…).
Variable
blurb_text = 'You are pretty smart!'
Template
{{ blurb_text|truncatechars:15 }}
Result
You are pretty…
Argument: n
(required)
– number of characters to truncate to.
Truncates a value to n
characters and appends an ellipsis (…).
blurb_text = 'You are pretty smart!'
{{ blurb_text|truncatechars:15 }}
You are pretty…
Did we get something wrong? Is there a use case for the
truncatechars
filter that we should add?
Please let us know.
Commentary
You should not use the
truncatechars
filter on HTML pages. Usetruncatechars_html
instead.