diff options
| author | Jannis Leidel <jannis@leidel.info> | 2011-07-14 13:47:10 +0000 |
|---|---|---|
| committer | Jannis Leidel <jannis@leidel.info> | 2011-07-14 13:47:10 +0000 |
| commit | 3b774583711e39dae7a5cfde314288f8019f59c6 (patch) | |
| tree | f14bf8b086ad3b4d46b6cd4e1ebbfb1938836737 /docs/ref/templates | |
| parent | 12b7c2a702bea68e53c438fa2c7a4a01d890695d (diff) | |
Fixed #5025 -- Add a "truncatechars" template filter. Many thanks to Chris Beaven.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16542 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/ref/templates')
| -rw-r--r-- | docs/ref/templates/builtins.txt | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/docs/ref/templates/builtins.txt b/docs/ref/templates/builtins.txt index bdac556652..5c08c66c21 100644 --- a/docs/ref/templates/builtins.txt +++ b/docs/ref/templates/builtins.txt @@ -2055,6 +2055,24 @@ For example:: If ``value`` is ``"my first post"``, the output will be ``"My First Post"``. +.. templatefilter:: truncatechars + +truncatechars +^^^^^^^^^^^^^ + +.. versionadded:: 1.4 + +Truncates a string if it is longer than the specified number of characters. +Truncated strings will end with a translatable ellipsis sequence ("..."). + +**Argument:** Number of characters to truncate to + +For example:: + + {{ value|truncatechars:9 }} + +If ``value`` is ``"Joel is a slug"``, the output will be ``"Joel i..."``. + .. templatefilter:: truncatewords truncatewords |
