26👍
✅
You can use slice filter:
<li><a href="/article_list_content-{{win_con.id}}/"><p>{{ win_con.content|slice:":5" }}</p><i class="font"></i></a></li>
- Annotating SUM aggregation function leading to 'None' value in Django
- Making Django Readonly ForeignKey Field in Admin Render as a Link
3👍
https://docs.djangoproject.com/en/1.11/ref/templates/builtins/#truncatechars should help
{{ value|truncatechars:9 }}
0👍
To cut specific characters do you could use ‘cut’ which is also part of django template builtins
for example if
{{ file.pdf.name}}
gives ‘store/pdfs/verma2010.pdf’
{{ file.pdf.name | cut:'store/pdfs/'}}
Would give ‘verma2010.pdf’
- Django: Heroku Failing to launch, at=error code=H10 desc="App crashed"
- One project, Multiple customers with git?
Source:stackexchange.com