how to show first 50 words of a text field in django template

前端 未结 1 1816
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-04 01:04

I have a field like this in my Django template:

{{news.description}}

I wanna show the first 50 words of this field. How c

相关标签:
1条回答
  • 2021-01-04 02:03

    From the documentation:

    {{ news.description|truncatewords:50 }}
    
    0 讨论(0)
提交回复
热议问题