9đź‘Ť
âś…
truncatechars¶
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…”.
👤Dmitry Yudin
0đź‘Ť
You can use Built-in Template tag "truncatewords", like this below:
{{ post.post_body | truncatewords:50 }}
This will show the first 50 words of your post.
Here is the Documentation
👤Sumon Ahmed
- [Django]-Celery beat process running on Heroku sends task twice
- [Django]-How to create a superuser in Django with Linux shell script?
- [Django]-Pass variable from middleware to templates
- [Django]-Parse textarea line by line (or a specific line #) with Django
Source:stackexchange.com