{% load i18n %} {% comment %} Renders one node of the address tree. node = { name, url, kind: 'group'|'leaf', ip_ref: {str,url}|None, netmask_tooltip: dotted-decimal netmask for IPv4 prefixes, children: [...] } depth = current nesting depth (0 = top-level) prefix = 'src' or 'dst' (for unique HTML IDs) forloop_counter = parent forloop.counter (for unique IDs) {% endcomment %} {% if node.kind == "group" %} {% if node.children %}
{{ node.name }} {% if node.leaf_count %}{{ node.leaf_count }}{% endif %} {% if show_copy and node.copy_lines %} {% endif %}
{% for child in node.children %} {% include "netbox_nsm/inc/addr_tree_node.html" with node=child depth=depth|add:1 prefix=prefix forloop_counter=forloop.counter %} {% endfor %}
{% else %}
{{ node.name }} (leer)
{% endif %} {% else %} {# Leaf node #}
{% if node.prefix_display_cidr and not node.ip_ref %} {{ node.prefix_display_cidr }} {% else %} {{ node.name }} {% endif %} {% if node.ip_ref %} {% if node.prefix_display_cidr %}{{ node.prefix_display_cidr }}{% else %}{{ node.ip_ref.str }}{% endif %} {% endif %} {% if show_copy and node.copy_lines %} {% endif %}
{% endif %}