From 060da0f8c414d0d3f93efcb83effe244874ba328 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Valenta?= <git@imaniti.org> Date: Sat, 2 Dec 2023 12:54:35 +0100 Subject: [PATCH] first 3 & fix ordering --- donate/models.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/donate/models.py b/donate/models.py index 3fc775aa..dd76b04d 100644 --- a/donate/models.py +++ b/donate/models.py @@ -410,7 +410,13 @@ class DonateProjectIndexPage( @property def projects(self): - return DonateProjectPage.objects.child_of(self).distinct().live().all() + return ( + DonateProjectPage.objects.child_of(self) + .filter() + .distinct() + .order_by("-date") + .live() + )[:3] class Meta: verbose_name = "Přehled projektů" -- GitLab