首页 > TAG信息列表 > queryset2

django queryset列表合并

import itertools queryset_top = query.filter(is_top=True).order_by("-updated_at") queryset2 = query.filter(is_top=False).order_by("-created_at") queryset = list(itertools.chain(queryset_top, queryset2)) 这样就实现了合并两个queryset, 并且queryse