From ec0560a2c547c6f480ab67b025fa979a939e5f3c Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Wed, 13 Oct 2021 14:16:10 -0400 Subject: [PATCH] Fix trace_paths command for wireless links --- netbox/dcim/management/commands/trace_paths.py | 6 +++++- netbox/dcim/tables/template_code.py | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/netbox/dcim/management/commands/trace_paths.py b/netbox/dcim/management/commands/trace_paths.py index fd5f9cfab..d0cd64486 100644 --- a/netbox/dcim/management/commands/trace_paths.py +++ b/netbox/dcim/management/commands/trace_paths.py @@ -1,6 +1,7 @@ from django.core.management.base import BaseCommand from django.core.management.color import no_style from django.db import connection +from django.db.models import Q from dcim.models import CablePath, ConsolePort, ConsoleServerPort, Interface, PowerFeed, PowerOutlet, PowerPort from dcim.signals import create_cablepath @@ -67,7 +68,10 @@ class Command(BaseCommand): # Retrace paths for model in ENDPOINT_MODELS: - origins = model.objects.filter(cable__isnull=False) + params = Q(cable__isnull=False) + if hasattr(model, 'wireless_link'): + params |= Q(wireless_link__isnull=False) + origins = model.objects.filter(params) if not options['force']: origins = origins.filter(_path__isnull=True) origins_count = origins.count() diff --git a/netbox/dcim/tables/template_code.py b/netbox/dcim/tables/template_code.py index 7e78cb97d..a5a4d9979 100644 --- a/netbox/dcim/tables/template_code.py +++ b/netbox/dcim/tables/template_code.py @@ -195,8 +195,10 @@ INTERFACE_BUTTONS = """ {% endif %} -{% if record.cable %} +{% if record.link %} +{% endif %} +{% if record.cable %} {% include 'dcim/inc/cable_toggle_buttons.html' with cable=record.cable %} {% if perms.dcim.delete_cable %}