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
This commit is contained in:
Jannis Leidel 2011-07-25 09:19:47 +00:00
parent b8db443437
commit afd8a47df7
1 changed files with 2 additions and 1 deletions

View File

@ -254,7 +254,7 @@ def truncatechars(value, arg):
length = int(arg) length = int(arg)
except ValueError: # Invalid literal for int(). except ValueError: # Invalid literal for int().
return value # Fail silently. return value # Fail silently.
return Truncator(value).chars(value, length) return Truncator(value).chars(length)
truncatechars.is_safe = True truncatechars.is_safe = True
truncatechars = stringfilter(truncatechars) truncatechars = stringfilter(truncatechars)
@ -922,6 +922,7 @@ register.filter(stringformat)
register.filter(striptags) register.filter(striptags)
register.filter(time) register.filter(time)
register.filter(title) register.filter(title)
register.filter(truncatechars)
register.filter(truncatewords) register.filter(truncatewords)
register.filter(truncatewords_html) register.filter(truncatewords_html)
register.filter(unordered_list) register.filter(unordered_list)