From 290faf0b8fb45103262a06acdbe5e58314ef9eef Mon Sep 17 00:00:00 2001 From: Jean-Marie Favreau Date: Fri, 13 Dec 2024 16:14:05 +0100 Subject: [PATCH] =?UTF-8?q?tentative=20d'am=C3=A9lioration=20des=20requ?= =?UTF-8?q?=C3=AAtes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/agenda_culturel/views.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/agenda_culturel/views.py b/src/agenda_culturel/views.py index dca5294..d35a94d 100644 --- a/src/agenda_culturel/views.py +++ b/src/agenda_culturel/views.py @@ -895,15 +895,15 @@ def administration(request): daily_modifications = Event.get_count_modifications([(d, 1) for d in days]) # get last created events - events = Event.objects.all().order_by("-created_date")[:5] + events = Event.objects.all().order_by("-created_date").select_related("exact_location", "category")[:5] # get last batch imports - batch_imports = BatchImportation.objects.all().order_by("-created_date")[:5] + batch_imports = BatchImportation.objects.all().select_related("recurrentImport").order_by("-created_date")[:5] # get info about batch information newest = BatchImportation.objects.filter(recurrentImport=OuterRef("pk")).order_by( "-created_date" - ) + ).select_related("recurrentImport") imported_events = RecurrentImport.objects.annotate( last_run_status=Subquery(newest.values("status")[:1]) ) @@ -929,7 +929,7 @@ def administration(request): Q(other_versions__representative__isnull=True)).values("start_day").\ annotate(not_moderated=Count("start_day", filter=Q(moderated_date__isnull=True))). \ annotate(nb_events=Count("start_day")). \ - order_by("start_day") + order_by("start_day").values("not_moderated", "nb_events", "start_day") max_not_moderated = max([x["not_moderated"] for x in nb_not_moderated]) if max_not_moderated == 0: