Show the last node in a CablePath with no destination

This commit is contained in:
Jeremy Stretch 2021-04-01 21:29:46 -04:00
parent e7f10fdaea
commit 5e4432b9ad
2 changed files with 8 additions and 1 deletions

View File

@ -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.

View File

@ -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