Django order_by query set, ascending and descending
How can I order by descending my query set in Django by date?
Reserved.objects.all().filter(client=client_id).order_by('check_in')
I just want to filter from descending all the Reserved by check_in date. How django order by desc ?
You can use the below-mentioned command for Django order_by query set, ascending and descending:-
Reserved.objects.filter(client=client_id).order_by('-check_in')
Or
Ascending order Reserved.objects. all(). filter(client=client_id).order_by('check_in')
Descending order Reserved.objects. all(). filter(client=client_id).order_by('-check_in')