你可以用
QuerySet.last()
获取最后一个并使用其id将其从结果中排除。
objects = Model.objects.filter(name='alpha').order_by('rank')
last = objects.last()
objects = objects.exclude(pk=last.pk)
从结果中排除所有按DB中的最小值排序的对象的查询:
objects = Model.objects.annotate(
mini_rank=Min('rank'), # Annotate each object with the minimum known rank
).exclude(
mini_rank=F('rank') # Exclude all objects ranked with the minimum value found
)