mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Clean up prefix hierarchy annotation
This commit is contained in:
@ -18,13 +18,11 @@ UTILIZATION_GRAPH = """
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
PREFIX_LINK = """
|
PREFIX_LINK = """
|
||||||
{% if record.children %}
|
{% load helpers %}
|
||||||
<span class="text-nowrap" style="padding-left: {{ record.parents }}0px "><i class="mdi mdi-chevron-right"></i></a>
|
{% for i in record.parents|as_range %}
|
||||||
{% else %}
|
<i class="mdi mdi-circle-small"></i>
|
||||||
<span class="text-nowrap" style="padding-left: {{ record.parents }}9px">
|
{% endfor %}
|
||||||
{% endif %}
|
<a href="{% if record.pk %}{% url 'ipam:prefix' pk=record.pk %}{% else %}{% url 'ipam:prefix_add' %}?prefix={{ record }}{% if parent.vrf %}&vrf={{ parent.vrf.pk }}{% endif %}{% if parent.site %}&site={{ parent.site.pk }}{% endif %}{% if parent.tenant %}&tenant_group={{ parent.tenant.group.pk }}&tenant={{ parent.tenant.pk }}{% endif %}{% endif %}">{{ record.prefix }}</a>
|
||||||
<a href="{% if record.pk %}{% url 'ipam:prefix' pk=record.pk %}{% else %}{% url 'ipam:prefix_add' %}?prefix={{ record }}{% if parent.vrf %}&vrf={{ parent.vrf.pk }}{% endif %}{% if parent.site %}&site={{ parent.site.pk }}{% endif %}{% if parent.tenant %}&tenant_group={{ parent.tenant.group.pk }}&tenant={{ parent.tenant.pk }}{% endif %}{% endif %}">{{ record.prefix }}</a>
|
|
||||||
</span>
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
PREFIX_ROLE_LINK = """
|
PREFIX_ROLE_LINK = """
|
||||||
|
@ -208,6 +208,14 @@ def split(string, sep=','):
|
|||||||
return string.split(sep)
|
return string.split(sep)
|
||||||
|
|
||||||
|
|
||||||
|
@register.filter()
|
||||||
|
def as_range(n):
|
||||||
|
"""
|
||||||
|
Return a range of n items.
|
||||||
|
"""
|
||||||
|
return range(n)
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Tags
|
# Tags
|
||||||
#
|
#
|
||||||
|
Reference in New Issue
Block a user