diff --git a/chat_box/views.py b/chat_box/views.py index 95a3582..08a2a9e 100644 --- a/chat_box/views.py +++ b/chat_box/views.py @@ -403,6 +403,7 @@ def get_unread_count(rooms, user): mess = Message.objects.filter(room__isnull=True, time__gte=OuterRef('last_seen'))\ .exclude(author=user)\ + .order_by().values('room')\ .annotate(unread_count=Count('pk')).values('unread_count') return UserRoom.objects\