issue 120 order in dashboard

This commit is contained in:
Cayo Puigdefabregas 2024-02-28 09:36:50 +01:00
parent 378401f8a9
commit e32098aa63
2 changed files with 3 additions and 2 deletions

View File

@ -132,7 +132,7 @@ class DashboardView(AdminView, SingleTableView):
Override the get_queryset method to filter events based on the user type. Override the get_queryset method to filter events based on the user type.
""" """
events_for_admins = self.get_admin_events() 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): def get_admin_events(self):
return [ return [

View File

@ -65,7 +65,8 @@ class DashboardView(UserView, SingleTableView):
def get_queryset(self, **kwargs): def get_queryset(self, **kwargs):
events_for_users = self.get_user_events() events_for_users = self.get_user_events()
queryset = Event.objects.select_related('user').filter( 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 return queryset