diff --git a/app/api/views.py b/app/api/views.py index bd1c8bfe..394a4fc4 100644 --- a/app/api/views.py +++ b/app/api/views.py @@ -1,5 +1,7 @@ import collections import json +import random + from django.conf import settings from django.contrib.auth.models import User from django.db import transaction @@ -171,7 +173,9 @@ class DocumentList(generics.ListCreateAPIView): queryset = project.documents if project.randomize_document_order: - queryset = queryset.annotate(sort_id=F('id') % self.request.user.id).order_by('sort_id') + random.seed(self.request.user.id) + value = random.randrange(2, 20) + queryset = queryset.annotate(sort_id=F('id') % value).order_by('sort_id', 'id') else: queryset = queryset.order_by('id')