From 0794056d19c1dce8cef79a656b47f50e4b05de8d Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Wed, 7 Aug 2019 00:08:19 +0200 Subject: [PATCH] Optimisation chargement des locaux --- topologie/views.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/topologie/views.py b/topologie/views.py index 97b430fc..01c21cfb 100644 --- a/topologie/views.py +++ b/topologie/views.py @@ -267,9 +267,9 @@ def index_physical_grouping(request): .prefetch_related( 'switch_set__interface_set__domain__extension' )) - building_list = Building.objects.all() - dormitory_list = Dormitory.objects.all() - switch_bay_list = SwitchBay.objects.select_related('building') + building_list = Building.objects.all().select_related('dormitory') + dormitory_list = Dormitory.objects.all().prefetch_related('building_set') + switch_bay_list = SwitchBay.objects.select_related('building__dormitory').prefetch_related('switch_set__interface_set__domain') stack_list = SortTable.sort( stack_list, request.GET.get('col'),