From 07eddfffb78940cbd88d476f1d5957c0d336879e 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 40cf8eae..22901d09 100644 --- a/api/views.py +++ b/api/views.py @@ -535,7 +535,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