Fixes #19587: Occupied filter should match on interfaces terminating a wireless link (#19631)

This commit is contained in:
Jeremy Stretch
2025-06-03 10:34:39 -04:00
committed by GitHub
parent f45b671fc9
commit 77f0eeb7bf
2 changed files with 23 additions and 5 deletions

View File

@@ -2012,6 +2012,21 @@ class InterfaceFilterSet(
'wireless': queryset.filter(type__in=WIRELESS_IFACE_TYPES),
}.get(value, queryset.none())
# Override the method on CabledObjectFilterSet to also check for wireless links
def filter_occupied(self, queryset, name, value):
if value:
return queryset.filter(
Q(cable__isnull=False) |
Q(wireless_link__isnull=False) |
Q(mark_connected=True)
)
else:
return queryset.filter(
cable__isnull=True,
wireless_link__isnull=True,
mark_connected=False
)
class FrontPortFilterSet(
ModularDeviceComponentFilterSet,