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

Fixes #5627: Fix filtering of interface connections list

This commit is contained in:
jeremystretch
2021-07-27 16:21:56 -04:00
parent e92f13977c
commit a1eb4dc807
3 changed files with 3 additions and 8 deletions

View File

@ -592,11 +592,9 @@ class PowerConnectionViewSet(ListModelMixin, GenericViewSet):
class InterfaceConnectionViewSet(ListModelMixin, GenericViewSet):
queryset = Interface.objects.prefetch_related('device', '_path').filter(
# Avoid duplicate connections by only selecting the lower PK in a connected pair
_path__destination_type__app_label='dcim',
_path__destination_type__model='interface',
_path__destination_id__isnull=False,
pk__lt=F('_path__destination_id')
_path__destination_id__isnull=False
)
serializer_class = serializers.InterfaceConnectionSerializer
filterset_class = filtersets.InterfaceConnectionFilterSet