Just prefix a '-'
before the column name to reverse the order. You can supply order_by
at the time of initializing the table.
def index(request):
table = OrderTable(Order.objects.all(), order_by="-order_date")
RequestConfig(request, paginate={"per_page": 10}).configure(table)
return render(request, 'orders_app/index.html', {'table': table})
See order_by
:
The default ordering. e.g.
('name', '-age')
. A hyphen-
can be used to prefix a column name to indicate descending order.