In Django docs for inline tags and filters, they provide a filter to truncate words, but not characters (letters / numbers / spaces, etc.). Is there such a thing?
You can use fragment notation: {{ a_string_variable|slice:":5" }} This will give you the first 5 characters in a line.
{{ a_string_variable|slice:":5" }}
Starting with Django 1.4, truncatechars now a built-in filter in the release.
truncatechars
https://docs.djangoproject.com/en/1.4/ref/templates/builtins/#truncatechars
I used this before and worked great:
http://djangosnippets.org/snippets/194/
It was a feature request for 4 years, but finally landed in the trunk, as I understand it https://code.djangoproject.com/ticket/5025 - so weve to wait for the next release or use of the trunk.