@@ -73,6 +73,7 @@ class BundleList(BundleMixin, ListAPIView):
filter_class = BundleFilter
search_fields = ('name',)
ordering_fields = ('id', 'name', 'owner')
+ ordering = 'id'
class BundleDetail(BundleMixin, RetrieveAPIView):
@@ -99,6 +99,7 @@ class CheckListCreate(CheckMixin, ListCreateAPIView):
"""List or create checks."""
lookup_url_kwarg = 'patch_id'
+ ordering = 'id'
def create(self, request, patch_id, *args, **kwargs):
p = Patch.objects.get(id=patch_id)
@@ -70,6 +70,7 @@ class CoverLetterList(ListAPIView):
filter_class = CoverLetterFilter
search_fields = ('name',)
ordering_fields = ('id', 'name', 'date', 'submitter')
+ ordering = 'id'
def get_queryset(self):
qs = CoverLetter.objects.all().prefetch_related('series')\
@@ -97,13 +97,12 @@ class EventList(ListAPIView):
serializer_class = EventSerializer
filter_class = EventFilter
page_size_query_param = None # fixed page size
- ordering = '-date'
ordering_fields = ()
+ ordering = '-date'
def get_queryset(self):
return Event.objects.all()\
.select_related('project', 'patch', 'series', 'cover',
'previous_state', 'current_state',
'previous_delegate', 'current_delegate',
- 'created_check')\
- .order_by('-date')
+ 'created_check')
@@ -145,6 +145,7 @@ class PatchList(ListAPIView):
search_fields = ('name',)
ordering_fields = ('id', 'name', 'project', 'date', 'state', 'archived',
'submitter', 'check')
+ ordering = 'id'
def get_queryset(self):
return Patch.objects.all().with_tag_counts()\
@@ -48,6 +48,7 @@ class PersonList(PersonMixin, ListAPIView):
search_fields = ('name', 'email')
ordering_fields = ('id', 'name', 'email')
+ ordering = 'id'
class PersonDetail(PersonMixin, RetrieveAPIView):
@@ -77,6 +77,7 @@ class ProjectList(ProjectMixin, ListAPIView):
search_fields = ('link_name', 'list_id', 'list_email', 'web_url',
'scm_url', 'webscm_url')
ordering_fields = ('id', 'name', 'link_name', 'list_id')
+ ordering = 'id'
class ProjectDetail(ProjectMixin, RetrieveUpdateAPIView):
@@ -60,6 +60,7 @@ class SeriesList(SeriesMixin, ListAPIView):
filter_class = SeriesFilter
search_fields = ('name',)
ordering_fields = ('id', 'name', 'date', 'submitter', 'received_all')
+ ordering = 'id'
class SeriesDetail(SeriesMixin, RetrieveAPIView):
@@ -58,6 +58,7 @@ class UserList(UserMixin, ListAPIView):
search_fields = ('username', 'first_name', 'last_name', 'email')
ordering_fields = ('id', 'username', 'email')
+ ordering = 'id'
class UserDetail(UserMixin, RetrieveUpdateAPIView):
This hides warnings likes the following: UnorderedObjectListWarning: Pagination may yield inconsistent results with an unordered object_list: <QuerySet [<User: test_user_0>]> Signed-off-by: Stephen Finucane <stephen@that.guru> --- patchwork/api/bundle.py | 1 + patchwork/api/check.py | 1 + patchwork/api/cover.py | 1 + patchwork/api/event.py | 5 ++--- patchwork/api/patch.py | 1 + patchwork/api/person.py | 1 + patchwork/api/project.py | 1 + patchwork/api/series.py | 1 + patchwork/api/user.py | 1 + 9 files changed, 10 insertions(+), 3 deletions(-)