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

Added dedicated cable trace view; removed modal

This commit is contained in:
Jeremy Stretch
2018-10-30 16:30:03 -04:00
parent 669fe1f192
commit 470aabe1d7
9 changed files with 111 additions and 10 deletions

View File

@@ -85,6 +85,7 @@ class CableTermination(models.Model):
]
"""
def get_peer_port(termination, position=1):
from circuits.models import CircuitTermination
# Map a front port to its corresponding rear port
if isinstance(termination, FrontPort):
@@ -102,6 +103,13 @@ class CableTermination(models.Model):
)
return peer_port, 1
# Follow a circuit to its other termination
elif isinstance(termination, CircuitTermination):
peer_termination = termination.get_peer_termination()
if peer_termination is None:
return None, None
return peer_termination, position
# Termination is not a pass-through port
else:
return None, None