Blueherb In solitude, where we are least alone

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 排序字段

posted @ 2019-12-21 21:14  奏乐乐章  阅读(549)  评论(0编辑  收藏  举报