May 2018
Beginner to intermediate
526 pages
11h 57m
English
You can order results by different fields using the order_by() method of the manager. For example, you can retrieve all objects ordered by their title, as follows:
Post.objects.order_by('title')
Ascending order is implied. You can indicate descending order with a negative sign prefix, like this:
Post.objects.order_by('-title')
Read now
Unlock full access