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

Improved device interface list performance

This commit is contained in:
Jeremy Stretch
2016-12-27 13:21:19 -05:00
parent 5716207ba6
commit e647065e63
6 changed files with 27 additions and 16 deletions

View File

@@ -382,7 +382,7 @@ class InterfaceNestedSerializer(InterfaceSerializer):
class InterfaceDetailSerializer(InterfaceSerializer):
connected_interface = InterfaceSerializer(source='get_connected_interface')
connected_interface = InterfaceSerializer()
class Meta(InterfaceSerializer.Meta):
fields = ['id', 'device', 'name', 'form_factor', 'mac_address', 'mgmt_only', 'description', 'is_connected',

View File

@@ -455,7 +455,7 @@ class RelatedConnectionsView(APIView):
peer_iface = Interface.objects.get(device__name=peer_device, name=peer_interface)
except Interface.DoesNotExist:
raise Http404()
local_iface = peer_iface.get_connected_interface()
local_iface = peer_iface.connected_interface
if local_iface:
device = local_iface.device
else: