UnorderedObjectListWarning: Pagination may yield inconsistent results with an unordered object_list: <class 'courses.models.Video'> QuerySet.
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 排序字段