From e32098aa63713940d933b590e8402141c22b9d0a Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Wed, 28 Feb 2024 09:36:50 +0100 Subject: [PATCH] issue 120 order in dashboard --- idhub/admin/views.py | 2 +- idhub/user/views.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/idhub/admin/views.py b/idhub/admin/views.py index 5ead31a..b670889 100644 --- a/idhub/admin/views.py +++ b/idhub/admin/views.py @@ -132,7 +132,7 @@ class DashboardView(AdminView, SingleTableView): Override the get_queryset method to filter events based on the user type. """ events_for_admins = self.get_admin_events() - return Event.objects.filter(type__in=events_for_admins) + return Event.objects.filter(type__in=events_for_admins).order_by("-created") def get_admin_events(self): return [ diff --git a/idhub/user/views.py b/idhub/user/views.py index 984c6b9..97e3993 100644 --- a/idhub/user/views.py +++ b/idhub/user/views.py @@ -65,7 +65,8 @@ class DashboardView(UserView, SingleTableView): def get_queryset(self, **kwargs): events_for_users = self.get_user_events() queryset = Event.objects.select_related('user').filter( - user=self.request.user).filter(type__in=events_for_users) + user=self.request.user).filter( + type__in=events_for_users).order_by("-created") return queryset