show children nodes depending on selected parent

前端 未结 3 475
-上瘾入骨i
-上瘾入骨i 2021-02-10 16:51

Hi i\'ve been looking all over and can\'t find the answer to this. I have only 3 months experience in using python/django so excuse my dummy quesion! Im using django mptt to di

3条回答
  •  梦毁少年i
    2021-02-10 17:25

    You can try this:

    {% recursetree nodes %}
        #check if the node is a child node
        {% if node.is_child_node %}
            {{ node.name }}
        {% endif %}
    
        #check if a root node is the current category
        {% if node.is_root_node and node.name == category.name %}
            {{ children }}
        {% endif %}
    
    {% endrecursetree %}
    

提交回复
热议问题