From a8442fd081c566f09944bcfc532dc4b0f66e86ed Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Sat, 27 May 2017 23:54:43 +0200 Subject: [PATCH] =?UTF-8?q?Select=5Frelated=20et=20acc=C3=A9l=C3=A9ration?= =?UTF-8?q?=20des=20vues=20rest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Conflicts: machines/views.py --- logs/views.py | 2 +- machines/views.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/logs/views.py b/logs/views.py index e6ab1ed0..f16e9807 100644 --- a/logs/views.py +++ b/logs/views.py @@ -68,7 +68,7 @@ def form(ctx, template, request): @login_required @permission_required('cableur') def index(request): - revisions = Revision.objects.all().order_by('date_created').reverse() + revisions = Revision.objects.all().order_by('date_created').reverse().select_related('user').prefetch_related('version_set__object') paginator = Paginator(revisions, PAGINATION_NUMBER) page = request.GET.get('page') try: diff --git a/machines/views.py b/machines/views.py index 96ab1d48..d3f70dbe 100644 --- a/machines/views.py +++ b/machines/views.py @@ -609,7 +609,7 @@ def del_alias(request, interfaceid): @login_required @permission_required('cableur') def index(request): - machines_list = Machine.objects.select_related('user').prefetch_related('interface_set__domain__extension').prefetch_related('interface_set__ipv4__ip_type__extension').prefetch_related('interface_set__type').order_by('pk') + machines_list = Machine.objects.select_related('user').prefetch_related('interface_set__domain__extension').prefetch_related('interface_set__ipv4__ip_type__extension').prefetch_related('interface_set__type').prefetch_related('interface_set__domain__related_domain').order_by('pk') paginator = Paginator(machines_list, PAGINATION_LARGE_NUMBER) page = request.GET.get('page') try: @@ -637,9 +637,15 @@ def index_machinetype(request): @login_required @permission_required('cableur') def index_extension(request): +<<<<<<< HEAD extension_list = Extension.objects.order_by('name') mx_list = Mx.objects.order_by('zone') ns_list = Ns.objects.order_by('zone') +======= + extension_list = Extension.objects.select_related('origin').order_by('name') + mx_list = Mx.objects.order_by('zone').select_related('zone').select_related('name__extension') + ns_list = Ns.objects.order_by('zone').select_related('zone').select_related('ns__extension') +>>>>>>> 39f3994... Select_related et accélération des vues rest return render(request, 'machines/index_extension.html', {'extension_list':extension_list, 'mx_list': mx_list, 'ns_list': ns_list}) @login_required