diff --git a/dashboard/views.py b/dashboard/views.py index e637547..d68af59 100644 --- a/dashboard/views.py +++ b/dashboard/views.py @@ -87,6 +87,9 @@ def dashboard(request): 'days_until_event': days_until_event, 'local_start_time_iso': local_start_time.isoformat() }) + + # Sort the final list by event start time + events_with_participation.sort(key=lambda x: x['event'].start_time) # Get children's events if hasattr(user, 'children'): @@ -103,6 +106,9 @@ def dashboard(request): for event in child_events: participation, created = EventParticipation.objects.get_or_create(user=child, event=event) child_events_list.append({'event': event, 'participation': participation}) + + # Sort each child's event list + child_events_list.sort(key=lambda x: x['event'].start_time) children_events.append({'child': child, 'events': child_events_list}) context = {