From 5e4432b9ad3885f1f8b69c08f6cabfcafcab4794 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Thu, 1 Apr 2021 21:29:46 -0400 Subject: [PATCH] Show the last node in a CablePath with no destination --- netbox/dcim/models/cables.py | 7 +++++++ netbox/dcim/tables/devices.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/netbox/dcim/models/cables.py b/netbox/dcim/models/cables.py index 806b74054..28d21ff68 100644 --- a/netbox/dcim/models/cables.py +++ b/netbox/dcim/models/cables.py @@ -505,6 +505,13 @@ class CablePath(BigIDModel): return path + @property + def last_node(self): + """ + Return either the destination or the last node within the path. + """ + return self.destination or path_node_to_object(self.path[-1]) + def get_cable_ids(self): """ Return all Cable IDs within the path. diff --git a/netbox/dcim/tables/devices.py b/netbox/dcim/tables/devices.py index 122eb7489..4aac227e9 100644 --- a/netbox/dcim/tables/devices.py +++ b/netbox/dcim/tables/devices.py @@ -260,7 +260,7 @@ class CableTerminationTable(BaseTable): class PathEndpointTable(CableTerminationTable): connection = tables.TemplateColumn( - accessor='_path.destination', + accessor='_path.last_node', template_code=CABLETERMINATION, verbose_name='Connection', orderable=False