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 | |
| 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')
| -rw-r--r-- | docs/internals/deprecation.txt | 6 | ||||
| -rw-r--r-- | docs/ref/templates/builtins.txt | 18 | ||||
| -rw-r--r-- | docs/releases/1.4.txt | 8 |
3 files changed, 32 insertions, 0 deletions
diff --git a/docs/internals/deprecation.txt b/docs/internals/deprecation.txt index c20d5bec82..3639cc2fd0 100644 --- a/docs/internals/deprecation.txt +++ b/docs/internals/deprecation.txt @@ -220,6 +220,12 @@ their deprecation, as per the :ref:`Django deprecation policy was deprecated since Django 1.4 and will be removed in favor of the generic static files handling. + * The builin truncation functions + :func:`django.utils.text.truncate_words` and + :func:`django.utils.text.truncate_html_words` + were deprecated since Django 1.4 and will be removed in favor + of the ``django.utils.text.Truncator`` class. + * 2.0 * ``django.views.defaults.shortcut()``. This function has been moved to ``django.contrib.contenttypes.views.shortcut()`` as part of the 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 diff --git a/docs/releases/1.4.txt b/docs/releases/1.4.txt index 55d845305c..43c9ae25c5 100644 --- a/docs/releases/1.4.txt +++ b/docs/releases/1.4.txt @@ -145,6 +145,14 @@ A new helper function, ``template.Library`` to ease the creation of template tags that store some data in a specified context variable. +``truncatechars`` template filter +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Added a filter which truncates a string to be no longer than the specified +number of characters. Truncated strings end with a translatable ellipsis +sequence ("..."). See the :tfilter:`truncatechars docs <truncatechars>` for +more details. + CSRF improvements ~~~~~~~~~~~~~~~~~ |
