Просмотр исходного кода

Fixes #4196: Fix exception when viewing LLDP neighbors page

Jeremy Stretch 6 лет назад
Родитель
Сommit
84d078a539
2 измененных файлов с 3 добавлено и 1 удалено
  1. 1 0
      docs/release-notes/version-2.7.md
  2. 2 1
      netbox/dcim/views.py

+ 1 - 0
docs/release-notes/version-2.7.md

@@ -13,6 +13,7 @@
 * [#4179](https://github.com/netbox-community/netbox/issues/4179) - Site is required when creating a rack group or power panel
 * [#4183](https://github.com/netbox-community/netbox/issues/4183) - Fix representation of NaturalOrderingField values in change log
 * [#4194](https://github.com/netbox-community/netbox/issues/4194) - Role field should not be required when searching/filtering secrets
+* [#4196](https://github.com/netbox-community/netbox/issues/4196) - Fix exception when viewing LLDP neighbors page
 
 ---
 

+ 2 - 1
netbox/dcim/views.py

@@ -31,6 +31,7 @@ from utilities.views import (
 from virtualization.models import VirtualMachine
 from . import filters, forms, tables
 from .choices import DeviceFaceChoices
+from .constants import NONCONNECTABLE_IFACE_TYPES
 from .models import (
     Cable, ConsolePort, ConsolePortTemplate, ConsoleServerPort, ConsoleServerPortTemplate, Device, DeviceBay,
     DeviceBayTemplate, DeviceRole, DeviceType, FrontPort, FrontPortTemplate, Interface, InterfaceTemplate,
@@ -1181,7 +1182,7 @@ class DeviceLLDPNeighborsView(PermissionRequiredMixin, View):
     def get(self, request, pk):
 
         device = get_object_or_404(Device, pk=pk)
-        interfaces = device.vc_interfaces.connectable().prefetch_related(
+        interfaces = device.vc_interfaces.exclude(type__in=NONCONNECTABLE_IFACE_TYPES).prefetch_related(
             '_connected_interface__device'
         )