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

Replace legacy trace() method

This commit is contained in:
Jeremy Stretch
2020-10-02 14:54:16 -04:00
parent aa0d4c4145
commit e9da84f91a
7 changed files with 38 additions and 204 deletions

View File

@@ -1961,9 +1961,9 @@ class CableView(ObjectView):
})
class CableTraceView(ObjectView):
class PathTraceView(ObjectView):
"""
Trace a cable path beginning from the given termination.
Trace a cable path beginning from the given path endpoint (origin).
"""
additional_permissions = ['dcim.view_cable']
@@ -1976,7 +1976,7 @@ class CableTraceView(ObjectView):
def get(self, request, pk):
obj = get_object_or_404(self.queryset, pk=pk)
path, split_ends, position_stack = obj.trace()
path = obj.trace()
total_length = sum(
[entry[1]._abs_length for entry in path if entry[1] and entry[1]._abs_length]
)
@@ -1984,8 +1984,6 @@ class CableTraceView(ObjectView):
return render(request, 'dcim/cable_trace.html', {
'obj': obj,
'trace': path,
'split_ends': split_ends,
'position_stack': position_stack,
'total_length': total_length,
})