diff --git a/netbox/dcim/models.py b/netbox/dcim/models.py
index e3032a295..0f0bb7a1b 100644
--- a/netbox/dcim/models.py
+++ b/netbox/dcim/models.py
@@ -2392,9 +2392,7 @@ class Cable(ChangeLoggedModel):
)
def __str__(self):
- if self.label:
- return '{} (#{})'.format(self.label, self.pk)
- return '#{}'.format(self.pk)
+ return self.label if self.label else '#{}'.format(self.pk)
def get_absolute_url(self):
return reverse('dcim:cable', args=[self.pk])
diff --git a/netbox/templates/dcim/device.html b/netbox/templates/dcim/device.html
index bbcbfaab1..e2ae02bff 100644
--- a/netbox/templates/dcim/device.html
+++ b/netbox/templates/dcim/device.html
@@ -526,8 +526,8 @@
LAG |
Description |
Mode |
- Connection |
Cable |
+ Connection |
|
@@ -590,8 +590,8 @@
|
{% endif %}
Name |
- Connection |
Cable |
+ Connection |
|
@@ -649,8 +649,8 @@
|
{% endif %}
Name |
- Connection |
Cable |
+ Connection |
|
diff --git a/netbox/templates/dcim/inc/consoleport.html b/netbox/templates/dcim/inc/consoleport.html
index e948e1784..6e115ad0d 100644
--- a/netbox/templates/dcim/inc/consoleport.html
+++ b/netbox/templates/dcim/inc/consoleport.html
@@ -5,6 +5,15 @@
{{ cp }}
+ {# Cable #}
+
+ {% with cable=cp.get_connected_cable %}
+ {% if cable %}
+ via {{ cable }}
+ {% endif %}
+ {% endwith %}
+ |
+
{# Connection #}
{% if cp.connected_endpoint %}
@@ -19,15 +28,6 @@
|
{% endif %}
- {# Cable #}
-
- {% with cable=cp.get_connected_cable %}
- {% if cable %}
- via {{ cable }}
- {% endif %}
- {% endwith %}
- |
-
{# Actions #}
{% if perms.dcim.change_consoleport %}
diff --git a/netbox/templates/dcim/inc/consoleserverport.html b/netbox/templates/dcim/inc/consoleserverport.html
index 001590686..ab06d0b84 100644
--- a/netbox/templates/dcim/inc/consoleserverport.html
+++ b/netbox/templates/dcim/inc/consoleserverport.html
@@ -12,6 +12,18 @@
{{ csp }}
|
+ {# Cable #}
+
+ {% with cable=csp.get_connected_cable %}
+ {% if cable %}
+ {{ cable }}
+ {% if cable.far_end != csp.connected_endpoint %}
+ to {{ cable.far_end.device }} {{ cable.far_end }}
+ {% endif %}
+ {% endif %}
+ {% endwith %}
+ |
+
{# Connection #}
{% if csp.connected_endpoint %}
@@ -26,18 +38,6 @@
|
{% endif %}
- {# Cable #}
-
- {% with cable=csp.get_connected_cable %}
- {% if cable %}
- {{ cable }}
- {% if cable.far_end != csp.connected_endpoint %}
- to {{ cable.far_end.device }} {{ cable.far_end }}
- {% endif %}
- {% endif %}
- {% endwith %}
- |
-
{# Actions #}
{% if perms.dcim.change_consoleserverport %}
diff --git a/netbox/templates/dcim/inc/frontport.html b/netbox/templates/dcim/inc/frontport.html
index 5d2a7b5d5..9297585ee 100644
--- a/netbox/templates/dcim/inc/frontport.html
+++ b/netbox/templates/dcim/inc/frontport.html
@@ -23,7 +23,7 @@
{# Cable #}
|
{% if cable %}
- {{ cable }} to {{ cable.far_end.device }} {{ cable.far_end }}
+ {{ cable }} to {{ cable.far_end.device }} {{ cable.far_end }}
{% else %}
Not connected
{% endif %}
diff --git a/netbox/templates/dcim/inc/interface.html b/netbox/templates/dcim/inc/interface.html
index 0dfb44bd6..30eced3e0 100644
--- a/netbox/templates/dcim/inc/interface.html
+++ b/netbox/templates/dcim/inc/interface.html
@@ -28,6 +28,18 @@
{# 802.1Q mode #}
| {{ iface.get_mode_display }} |
+ {# Cable #}
+
+ {% with cable=iface.get_connected_cable %}
+ {% if cable %}
+ {{ cable }}
+ {% if cable.far_end != csp.connected_endpoint %}
+ to {{ cable.far_end.device }} {{ cable.far_end }}
+ {% endif %}
+ {% endif %}
+ {% endwith %}
+ |
+
{# Connection or type #}
{% if iface.is_lag %}
@@ -69,18 +81,6 @@
|
{% endif %}
- {# Cable #}
-
- {% with cable=iface.get_connected_cable %}
- {% if cable %}
- {{ cable }}
- {% if cable.far_end != csp.connected_endpoint %}
- to {{ cable.far_end.device }} {{ cable.far_end }}
- {% endif %}
- {% endif %}
- {% endwith %}
- |
-
{# Buttons #}
{% if show_graphs %}
diff --git a/netbox/templates/dcim/inc/poweroutlet.html b/netbox/templates/dcim/inc/poweroutlet.html
index 104908fd5..3cc9ca242 100644
--- a/netbox/templates/dcim/inc/poweroutlet.html
+++ b/netbox/templates/dcim/inc/poweroutlet.html
@@ -12,6 +12,15 @@
{{ po }}
|
+ {# Cable #}
+
+ {% with cable=po.get_connected_cable %}
+ {% if cable %}
+ {{ cable }}
+ {% endif %}
+ {% endwith %}
+ |
+
{# Connection #}
{% if po.connected_endpoint %}
@@ -26,15 +35,6 @@
|
{% endif %}
- {# Cable #}
-
- {% with cable=po.get_connected_cable %}
- {% if cable %}
- {{ cable }}
- {% endif %}
- {% endwith %}
- |
-
{# Actions #}
{% if perms.dcim.change_poweroutlet %}
diff --git a/netbox/templates/dcim/inc/powerport.html b/netbox/templates/dcim/inc/powerport.html
index cb77ce7de..44a10b2fd 100644
--- a/netbox/templates/dcim/inc/powerport.html
+++ b/netbox/templates/dcim/inc/powerport.html
@@ -5,6 +5,15 @@
{{ pp }}
|
+ {# Cable #}
+
+ {% with cable=pp.get_connected_cable %}
+ {% if cable %}
+ via {{ cable }}
+ {% endif %}
+ {% endwith %}
+ |
+
{# Connection #}
{% if pp.connected_endpoint %}
@@ -19,15 +28,6 @@
|
{% endif %}
- {# Cable #}
-
- {% with cable=pp.get_connected_cable %}
- {% if cable %}
- via {{ cable }}
- {% endif %}
- {% endwith %}
- |
-
{# Actions #}
{% if perms.dcim.change_powerport %}
diff --git a/netbox/templates/dcim/inc/rearport.html b/netbox/templates/dcim/inc/rearport.html
index 1c92f0991..9a8128de4 100644
--- a/netbox/templates/dcim/inc/rearport.html
+++ b/netbox/templates/dcim/inc/rearport.html
@@ -22,7 +22,7 @@
{# Cable #}
|
{% if cable %}
- {{ cable }} to {{ cable.far_end.device }} {{ cable.far_end }}
+ {{ cable }} to {{ cable.far_end.device }} {{ cable.far_end }}
{% else %}
Not connected
{% endif %}
|