Django | Set the defulat ordering rule for queries in the models

Though we can specify order explicitly in queries like below

Posts.objects.order_by('published')

it is repetitive and most of the times we will want to order by a particular field.

We can specify the order in the models like this

Leave a Reply