From 1e881e1647e3ac95b854a008d31eb20bbf786007 Mon Sep 17 00:00:00 2001 From: liangliangyy Date: Wed, 13 Feb 2019 23:42:34 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=84=E8=AE=BA=E5=B1=82=E7=BA=A7=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E4=BF=AE=E6=94=B9=20close=20#212?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../comments/tags/comment_item_tree.html | 44 +++++++++++++++++++ templates/comments/tags/comment_list.html | 20 ++------- 2 files changed, 48 insertions(+), 16 deletions(-) create mode 100644 templates/comments/tags/comment_item_tree.html diff --git a/templates/comments/tags/comment_item_tree.html b/templates/comments/tags/comment_item_tree.html new file mode 100644 index 0000000..676b792 --- /dev/null +++ b/templates/comments/tags/comment_item_tree.html @@ -0,0 +1,44 @@ +{% load blog_tags %} +
  • +
    + + + + +

    {{ comment_item.body |escape|custom_markdown }}

    + + +
    + +
  • +{% query article_comments parent_comment=comment_item as cc_comments %} +{% for cc in cc_comments %} + {% with comment_item=cc template_name="comments/tags/comment_item_tree.html" %} + {% with depth=depth|add:1 %} + {% include template_name %} + {% endwith %} + {% endwith %} +{% endfor %} \ No newline at end of file diff --git a/templates/comments/tags/comment_list.html b/templates/comments/tags/comment_list.html index 44a15a8..79d36c0 100644 --- a/templates/comments/tags/comment_list.html +++ b/templates/comments/tags/comment_list.html @@ -11,28 +11,16 @@ {% if article_comments %} {% cache 36000 article_comments article.id %}
    -
      {% query article_comments parent_comment=None as parent_comments %} - {% for comment in parent_comments %} - {% show_comment_item comment False %} - - {% parse_commenttree article_comments comment as childcomments %} - {% if childcomments %} -
        - {% for child in childcomments %} - {% show_comment_item child True %} - - {% endfor %} -
      - {% endif %} - - + {% for comment_item in parent_comments %} + {% with 0 as depth %} + {% include "comments/tags/comment_item_tree.html" %} + {% endwith %} {% endfor %}
    -
    {% endcache %} {% endif %}