Fixes #3440: Total cable trace length

This commit is contained in:
Saria Hajjar
2020-01-08 10:49:58 +00:00
parent 770f4c962c
commit 996d49de67
4 changed files with 11 additions and 2 deletions

View File

@@ -1754,10 +1754,13 @@ class CableTraceView(PermissionRequiredMixin, View):
def get(self, request, model, pk):
obj = get_object_or_404(model, pk=pk)
trace = obj.trace(follow_circuits=True)
total_length = sum([entry[1]._abs_length for entry in trace if entry[1] and entry[1]._abs_length])
return render(request, 'dcim/cable_trace.html', {
'obj': obj,
'trace': obj.trace(follow_circuits=True),
'trace': trace,
'total_length': total_length,
})