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: