mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-23 17:08:41 -06:00
#6081: Tweak queryset filtering
This commit is contained in:
parent
03b3f5937f
commit
f096c4a5d0
@ -581,7 +581,8 @@ class PowerConnectionViewSet(ListModelMixin, GenericViewSet):
|
|||||||
class InterfaceConnectionViewSet(ListModelMixin, GenericViewSet):
|
class InterfaceConnectionViewSet(ListModelMixin, GenericViewSet):
|
||||||
queryset = Interface.objects.prefetch_related('device', '_path').filter(
|
queryset = Interface.objects.prefetch_related('device', '_path').filter(
|
||||||
# Avoid duplicate connections by only selecting the lower PK in a connected pair
|
# Avoid duplicate connections by only selecting the lower PK in a connected pair
|
||||||
_path__destination_type=ContentType.objects.get_by_natural_key('dcim', 'interface'),
|
_path__destination_type__app_label='dcim',
|
||||||
|
_path__destination_type__model='interface',
|
||||||
_path__destination_id__isnull=False,
|
_path__destination_id__isnull=False,
|
||||||
pk__lt=F('_path__destination_id')
|
pk__lt=F('_path__destination_id')
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user