首页 > 解决方案 > Django 内容片段

问题描述

我想在 100 片后显示一个“...更多”标签以显示完整的评论内容,有人可以帮忙吗?

模板:

   <div class="comment">
        {% for comment in post.comment_set.all %}
            <p>{{ comment.content| linebreaks}}</p>
            <p>{{ comment.content|slice:":100"|linebreaksbr}}
                {% if comment.content|length > 100 %}
                   ????
                {% endif %}</p>

标签: djangotemplatesslice

解决方案


推荐阅读