django desc order

You can use the order_by() method in Django to order querysets in descending order. Here's how to do it:


  • Model.objects retrieves all instances of the specified model.
  • order_by() is a method used to order the retrieved instances.
  • '-field_name' specifies the field by which the ordering should be done in descending order. The minus sign (-) before the field name indicates descending order.