【django】filter order_by asc/desc

昇順

_datas = Data.objects.all().order_by(‘pub_date’)[:20]

降順

_datas = Data.objects.all().order_by(‘-pub_date’)[:20]

Leave a Reply