From ad1366d90dc8f3d422290556fc1c971d9c3b0aaa Mon Sep 17 00:00:00 2001 From: Arthur Date: Tue, 20 Feb 2024 09:31:06 -0800 Subject: [PATCH 1/2] 14405 render link_peer to csv --- netbox/dcim/tables/devices.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/netbox/dcim/tables/devices.py b/netbox/dcim/tables/devices.py index 4c863e12a7f..90e6b4863e0 100644 --- a/netbox/dcim/tables/devices.py +++ b/netbox/dcim/tables/devices.py @@ -359,6 +359,17 @@ class CableTerminationTable(NetBoxTable): verbose_name=_('Mark Connected'), ) + def value_link_peer(self, value): + string = "" + for termination in value: + if value and not str: + string += " " + if termination.parent_object: + string += f"{termination.parent_object} > " + string += str(termination) + + return string + class PathEndpointTable(CableTerminationTable): connection = columns.TemplateColumn( From 695d83378c47f7fddcf1fada9c3de24763ae9c90 Mon Sep 17 00:00:00 2001 From: Arthur Date: Tue, 20 Feb 2024 11:08:46 -0800 Subject: [PATCH 2/2] 14405 review changes --- netbox/dcim/tables/devices.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/netbox/dcim/tables/devices.py b/netbox/dcim/tables/devices.py index 90e6b4863e0..d4c9641b60d 100644 --- a/netbox/dcim/tables/devices.py +++ b/netbox/dcim/tables/devices.py @@ -360,15 +360,9 @@ class CableTerminationTable(NetBoxTable): ) def value_link_peer(self, value): - string = "" - for termination in value: - if value and not str: - string += " " - if termination.parent_object: - string += f"{termination.parent_object} > " - string += str(termination) - - return string + return ', '.join([ + f"{termination.parent_object} > {termination}" for termination in value + ]) class PathEndpointTable(CableTerminationTable):