From 403d75622587bfffff2c98995ca1ddf025960e7e Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Sun, 8 Jul 2018 23:39:15 +0200 Subject: [PATCH] Optimisation chargement des switchs --- api/views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/views.py b/api/views.py index 03ebe349..55b4fd6a 100644 --- a/api/views.py +++ b/api/views.py @@ -508,7 +508,8 @@ class SwitchPortView(generics.ListAPIView): """Exposes the associations between hostname, mac address and IPv4 in order to build the DHCP lease files. """ - queryset = topologie.Switch.objects.all().prefetch_related('ports__custom_profile') + queryset = topologie.Switch.objects.all().select_related("switchbay").select_related("model__constructor").prefetch_related("ports__custom_profile__vlan_tagged").prefetch_related("ports__custom_profile__vlan_untagged").prefetch_related("ports__machine_interface__domain__extension").prefetch_related("ports__room") + serializer_class = serializers.SwitchPortSerializer