{% from 'base/panel.html' import base %} {% from 'base/panel.html' import count %} {% macro tag_list() -%} {{ base() }} {%- endmacro %} {% macro tag(tag) -%} {{ base() }} {{ count() }} {%- endmacro %} {% macro parents(tag) -%}
父节点
{% if tag.parent_id -%} {{ link(tag.parent.name) }} {% else %} {{ link('honmaple') }} {%- endif %}
{%- endmacro %} {% macro relation(tag) -%} {% set relates = tag.related_tags %} {% if relates -%}
相关节点
{% for child in relates -%} {{ link(child.name) }} {%- endfor %} {%- endif %} {%- endmacro %} {% macro children(tag) -%} {% set children = tag.children.all() %} {% if children -%}
子节点
{% for child in children -%} {{ link(child.name) }} {%- endfor %} {%- endif %} {%- endmacro %} {% macro link(name) -%}
{{ name }}
{%- endmacro %}