mirror of
https://github.com/django/django.git
synced 2025-06-04 19:19:13 +00:00
Added documentation for single filter for draft PR
This commit is contained in:
parent
5ed72087c4
commit
87d0d28d17
@ -2723,7 +2723,7 @@ Truncated strings will end with a translatable ellipsis character ("…").
|
||||
|
||||
**Argument:** Number of characters to truncate to
|
||||
|
||||
For example:
|
||||
For example in a template:
|
||||
|
||||
.. code-block:: html+django
|
||||
|
||||
@ -2731,6 +2731,20 @@ For example:
|
||||
|
||||
If ``value`` is ``"Joel is a slug"``, the output will be ``"Joel i…"``.
|
||||
|
||||
For example in Python:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from django.template.defaultfilters import truncatechars
|
||||
|
||||
truncated = truncatechars("Joel is a slug", 7)
|
||||
|
||||
If ``value`` is ``"Joel is a slug"``, the output will be ``"Joel i…"``.
|
||||
|
||||
.. function:: truncatechars(value, arg)
|
||||
|
||||
This function truncates a string after ``arg`` number of characters.
|
||||
|
||||
.. templatefilter:: truncatechars_html
|
||||
|
||||
``truncatechars_html``
|
||||
|
Loading…
x
Reference in New Issue
Block a user