1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Extend Cable model to support multiple A/B terminations

This commit is contained in:
jeremystretch
2022-04-25 17:10:15 -04:00
parent 6c290353c1
commit 4bb9b6ee26
16 changed files with 368 additions and 283 deletions

View File

@@ -13,14 +13,20 @@ CABLE_LENGTH = """
{% if record.length %}{{ record.length|simplify_decimal }} {{ record.length_unit }}{% endif %}
"""
CABLE_TERMINATION = """
{{ value|join:", " }}
"""
CABLE_TERMINATION_PARENT = """
{% if value.device %}
<a href="{{ value.device.get_absolute_url }}">{{ value.device }}</a>
{% elif value.circuit %}
<a href="{{ value.circuit.get_absolute_url }}">{{ value.circuit }}</a>
{% elif value.power_panel %}
<a href="{{ value.power_panel.get_absolute_url }}">{{ value.power_panel }}</a>
{% endif %}
{% with value.0 as termination %}
{% if termination.device %}
<a href="{{ termination.device.get_absolute_url }}">{{ termination.device }}</a>
{% elif termination.circuit %}
<a href="{{ termination.circuit.get_absolute_url }}">{{ termination.circuit }}</a>
{% elif termination.power_panel %}
<a href="{{ termination.power_panel.get_absolute_url }}">{{ termination.power_panel }}</a>
{% endif %}
{% endwith %}
"""
DEVICE_LINK = """