How to find that the content is truncated?

后端 未结 4 1250
误落风尘
误落风尘 2021-01-02 05:05

I\'m trying to build a blog app and the problem is when I use tag \'truncatewords_html\' in my template to truncate posts longer than specified number of words, I need to li

4条回答
  •  灰色年华
    2021-01-02 05:22

    You could write a custom template tag (see django docs), or manually check in the template, whether the content you want to display exceeds the given length via length builtin filter.

提交回复
热议问题