How to make infinite threaded comments

眉间皱痕 提交于 2019-12-07 18:03:24

You need to turn your comments loop into a separate template

{% for i in comments %}
    <div class='comment_div' data-comment_id="{{ i.id }}">
        <div class="left_comment_div">
            <div class="username_and_votes">
                <h3><a class='username_foreign'>{{ i.user }}</a></h3>
            </div>
            <br>
            <p>{{ i.comment_text }}</p>
        </div>
    </div>
    {% include 'comments_template.html' with comments=i.replies.all %}
{% endfor %}

Then you just call this where you need it with

{% include 'comments_template.html' with comments=comment_list %}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!