{% load mptt_tags %} {% load comments %} {% with nodes.last as lastnode %} {% recursetree nodes %} {% get_latest_version as latest_version %} {# "last-node-container" is given to a comments-node-container if it's the last node in each level of nodes. (level 1, each level 2, each level 3, etc.). #} {# Note: there may be more than one level-2 group of nodes. The class is given to the last node in each group. #} {# The if statment first check if node is the lastnode, that would be the last node in level-1. #} {# If false, it checks if the node has a parent. If so, it checks if the next node is the same as it's parents next node (basically checking if we moved up 1 level) #}
{# We skip the root node because it is used as a link to the parent_object (not an actual comment) #} {% if not node.is_root_node %} {% block comment %} {% include "comments/comment.html" %} {% endblock comment %} {% endif %} {% if node.level < max_depth %}
{{ children }} {# After the last child on each level we add the form to allow submission of a new comment at the children's level #} {# Note: the root node is NOT a real comment, but the first level of visible comments are still it's children #} {% block new_comment %}
{% block new-comment-buttons %} {% block extra_buttons %}{% endblock extra_buttons %} {% endblock new-comment-buttons %}
{% endblock %}
{% endif %}
{% endrecursetree %} {% endwith %} {% block no_comments %} {% if nodes.count == 1 and nodes.first.is_root_node %} {% block no_comments_message %}

No comments yet

{% endblock no_comments_message %} {% endif %} {% endblock no_comments %}