UnorderedObjectListWarning: Pagination may yield inconsistent results with an unordered object_list:

Posted bjlxxbj

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了UnorderedObjectListWarning: Pagination may yield inconsistent results with an unordered object_list:相关的知识,希望对你有一定的参考价值。

UnorderedObjectListWarning: Pagination may yield inconsistent results with an unordered object_list: <class ‘courses.models.Video‘> QuerySet.
paginator = self.django_paginator_class(queryset, page_size)

解决:
1.queryset = Video.objects.all().order_by(‘id’) 将查询结果集排序

2class Meta:

? ordering = [’-id’]
加入ordering 排序字段

以上是关于UnorderedObjectListWarning: Pagination may yield inconsistent results with an unordered object_list:的主要内容,如果未能解决你的问题,请参考以下文章