From afd8a47df7b66a52a310c62a6385d45f7c17c1a0 Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Mon, 25 Jul 2011 09:19:47 +0000 Subject: [PATCH] Fixed #16510 -- Actually added new truncatechars filter to the builtins and fixed a typo. Thanks, timdumol. git-svn-id: http://code.djangoproject.com/svn/django/trunk@16550 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/template/defaultfilters.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/django/template/defaultfilters.py b/django/template/defaultfilters.py index d52f901be4..b68cc03e6d 100644 --- a/django/template/defaultfilters.py +++ b/django/template/defaultfilters.py @@ -254,7 +254,7 @@ def truncatechars(value, arg): length = int(arg) except ValueError: # Invalid literal for int(). return value # Fail silently. - return Truncator(value).chars(value, length) + return Truncator(value).chars(length) truncatechars.is_safe = True truncatechars = stringfilter(truncatechars) @@ -922,6 +922,7 @@ register.filter(stringformat) register.filter(striptags) register.filter(time) register.filter(title) +register.filter(truncatechars) register.filter(truncatewords) register.filter(truncatewords_html) register.filter(unordered_list)