django order_by query set, ascending and descending

gadss picture gadss · Mar 23, 2012 · Viewed 327.9k times · Source

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.

Answer

Keith picture Keith · Mar 23, 2012
Reserved.objects.filter(client=client_id).order_by('-check_in')

Notice the - before check_in.

Django Documentation