참고 포스팅: Django ORM (aggregate, annotate)
# 예시 코드: custom_list 순서대로 정렬 원할 때 from django.db.models import ( Case, Q, ) custom_list = [2, 10, 1, ...] order = Case( *[When(id=id, then=pos) for pos, id in enumerate(custom_list)] ) qs = qs.order_by(order)
멋지네요! :)
멋지네요! :)