Skip to content

Commit 7750ef4

Browse files
authored
AAP-41842: Fix pagination (#735)
Provides ordering by pk in the base DAB view such that all queries are returned in order of pk (if no other ordering is specified). This ensures that paginated returns are complete and no records are duplicated.
1 parent d758999 commit 7750ef4

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

ansible_base/activitystream/views.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,10 @@ class EntryReadOnlyViewSet(ReadOnlyModelViewSet, AnsibleBaseDjangoAppApiView):
3737
API endpoint that allows for read-only access to activity stream entries.
3838
"""
3939

40-
queryset = Entry.objects.order_by('-id')
40+
queryset = Entry.objects.all()
4141
serializer_class = EntrySerializer
4242
filter_backends = calculate_filter_backends()
43+
ordering = ['-id']
4344

4445
def get_permissions(self):
4546
"""

ansible_base/lib/utils/views/ansible_base.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
class AnsibleBaseView(APIView):
1313

14+
ordering = ['pk']
15+
1416
# pulp openapi generator compatibility
1517
endpoint_name = ''
1618

0 commit comments

Comments
 (0)