Skip to content

Add a default ordering on Django ViewSets #704

@ieaves

Description

@ieaves

The current Django ViewSets do not include ordering or ordering_fields settings which can affect paginated endpoints.

These should be set on

When complete, tests will no longer generate UnorderedObjectListWarning's e.g.

workspaces/tests/test_views.py::TestMemberships::test_get_memberships
workspaces/tests/test_views.py::TestMemberships::test_get_memberships_filter_by_is_active
  /Users/ian/Library/Caches/pypoetry/virtualenvs/the-guide-y4fToIIm-py3.11/lib/python3.11/site-packages/rest_framework/pagination.py:200: UnorderedObjectListWarning: Pagination may yield inconsistent results with an unordered object_list: <class 'workspaces.models.Membership'> QuerySet.
    paginator = self.django_paginator_class(queryset, page_size)

Metadata

Metadata

Assignees

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions