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

Fix tracing from front/rear ports

This commit is contained in:
Jeremy Stretch
2020-11-11 11:48:55 -05:00
parent 2b359ce1c7
commit d560e2da93
2 changed files with 50 additions and 48 deletions

View File

@@ -2026,6 +2026,7 @@ class PathTraceView(ObjectView):
# If tracing a PathEndpoint, locate the CablePath (if one exists) by its origin
if isinstance(obj, PathEndpoint):
path = obj._path
# Otherwise, find all CablePaths which traverse the specified object
else:
related_paths = CablePath.objects.filter(path__contains=obj).prefetch_related('origin')
@@ -2041,9 +2042,9 @@ class PathTraceView(ObjectView):
return render(request, 'dcim/cable_trace.html', {
'obj': obj,
'path': obj.trace(),
'path': path,
'related_paths': related_paths,
'total_length': path.get_total_length(),
'total_length': path.get_total_length() if path else None,
})