From 27fc44b88391828aaef6baef1b38d267435bb40c Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Wed, 30 Aug 2023 09:14:40 -0400 Subject: [PATCH] Misc cleanup --- docs/release-notes/version-3.6.md | 2 +- netbox/dcim/filtersets.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/release-notes/version-3.6.md b/docs/release-notes/version-3.6.md index 485c69b07..581241cd3 100644 --- a/docs/release-notes/version-3.6.md +++ b/docs/release-notes/version-3.6.md @@ -23,7 +23,7 @@ * The `device_role` field on the Device model has been renamed to `role`. The `device_role` field has been temporarily retained on the REST API serializer for devices for backward compatibility, but is read-only. * The `choices` array field has been removed from the CustomField model. Any defined choices are automatically migrated to CustomFieldChoiceSets, accessible via the new `choice_set` field on the CustomField model. * The `napalm_driver` and `napalm_args` fields (which were deprecated in v3.5) have been removed from the Platform model. -* The `device` and `device_id` filter for interfaces will now only filter the specific device. Two new filters `virtual_chassis_member` and `virtual_chassis_member_id` have been added to allow for retrieval of Virtual Chassis interfaces from any Virtual Chassis member. +* The `device` and `device_id` filter for interfaces will no longer include interfaces from virtual chassis peers. Two new filters, `virtual_chassis_member` and `virtual_chassis_member_id`, have been introduced to match all interfaces belonging to the specified device's virtual chassis (if any). * Reports and scripts are now returned within a `results` list when fetched via the REST API, consistent with other models. * Superusers can no longer retrieve API token keys via the web UI if [`ALLOW_TOKEN_RETRIEVAL`](https://docs.netbox.dev/en/stable/configuration/security/#allow_token_retrieval) is disabled. (The admin view has been removed per [#13044](https://github.com/netbox-community/netbox/issues/13044).) diff --git a/netbox/dcim/filtersets.py b/netbox/dcim/filtersets.py index b04eeda7e..0261998db 100644 --- a/netbox/dcim/filtersets.py +++ b/netbox/dcim/filtersets.py @@ -1541,8 +1541,7 @@ class InterfaceFilterSet( def filter_virtual_chassis_member(self, queryset, name, value): try: vc_interface_ids = [] - devices = Device.objects.filter(**{'{}__in'.format(name): value}) - for device in devices: + for device in Device.objects.filter(**{f'{name}__in': value}): vc_interface_ids.extend(device.vc_interfaces(if_master=False).values_list('id', flat=True)) return queryset.filter(pk__in=vc_interface_ids) except Device.DoesNotExist: