@register.filter(name='<STR_LIT>')<EOL>@stringfilter<EOL>def truncatechars(value, arg):
try:<EOL><INDENT>length = int(arg)<EOL><DEDENT>except ValueError: <EOL><INDENT>return value <EOL><DEDENT>if len(value) > length:<EOL><INDENT>return value[:length] + '<STR_LIT>'<EOL><DEDENT>return value<EOL>
Truncates a string after a certain number of chars.

Argument: Number of chars to truncate after.