A django app permits to highlight the searched words (self.query) in a long text and truncates it, counts number of chars == max_length
Use the following command: pip install twentytab-highlighter
INSTALLED_APPS = {
...,
'highlighter',
...
}
In your html template
{% load highlight_tags %}
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
{{a_very_long_text|highlight:"word"}}
</body>
</html>