About the Gotcha of order_by() Method

In Django QuerySets, most of the methods can be chained, but each consecutive order_by() overwrites the previous ones.

qs = Event.objects.order_by("start_date")
# Now it's ordered by title instead
qs = qs.order_by("title")

Tips and Tricks Programming Django 5.x Django 4.2 Django 3.2