From 5034c2656ccf5d808726210c98144b7bb9d05e7f Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Tue, 6 Aug 2019 04:30:04 +0200 Subject: [PATCH] Optimisation chargement des modules switchs --- topologie/views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/topologie/views.py b/topologie/views.py index 59532b99..c8be33b7 100644 --- a/topologie/views.py +++ b/topologie/views.py @@ -339,7 +339,8 @@ def index_model_switch(request): def index_module(request): """Display all modules of switchs""" module_list = ModuleSwitch.objects.all() - modular_switchs = Switch.objects.filter(model__is_modular=True) + modular_switchs = Switch.objects.filter(model__is_modular=True)\ + .select_related('model').prefetch_related('moduleonswitch_set__module') pagination_number = GeneralOption.get_cached_value('pagination_number') module_list = re2o_paginator(request, module_list, pagination_number) return render(