[Django]-Sorting tables when multiple tables in a view (django-tables2)

3👍

Well that was easy…

It was in the docs of course: I needed to add a prefix to my second table:

...
config = RequestConfig(self.request)
table2 = ot.UnfulfilledSalesOrderTable(om.SalesOrder.objects.filter(
    status__fulfilled=False, status__cancelled=False), self.request,
    prefix="2-")
config.configure(table2)
...

This adds a prefix to the querystring like so ?sort=ship_date&2-sort=number which achieves exactly the functionality I am after.

Leave a comment