Generic Filter/Sort Tables for Django?
Last update on .
So this came up (again). Users want to be able to look at a (largish) set of records in Django (millions of records) and do the following:
- click columns to sort by field values (with indication of sort direction, of course)
- filter by column values (include, exclude, greater-equal, less-equal); that is, they want to click on a button and have that value be included/excluded or used as a ge/le query
- see active filters, and be able to remove them
- see total counts, page through the current result sets
- make columns foreign-key links (field__remote_field)
- provide arbitrary formatters for field values
- cleanly handle all standard data-types (booleans and dates included)
- handle basic logic, such as removing exclude params when a filter for the same value is added
So, lazyweb, anyone know of such a beast that can be dropped into Django?
Comments are closed.
Pingbacks are closed.
Nick Coghlan on 12/21/2012 11 p.m. #
It doesn't do everything you asked for, but I found Django Tables 2 (https://github.com/bradleyayers/django-tables2) to be a lot better than starting from scratch.
While looking up the link for DT2, I also noticed https://github.com/benjiec/django-tables2-simplefilter. I haven't tried that one at all, but it seems to be aimed at the kind of filtering capability you mention.
DT2 uses server-side table rendering though - I think a lot of folks these days use JS table solutions instead, since they can do the sorting, etc, client side.
Wouter van Atteveldt on 12/22/2012 3:34 p.m. #
We are using a combination of the rest framework and js datatables that is working fairly well. The web page makes an ajax request back to the rest API and uses js to display it in a nice table featuring search, filtering, and dynamic lazy loading (eg new records are fetched as the scrollbar goes down.
The glue code is integrated in our larger project (https://code.google.com/p/amcat) but we are trying to split it off as a separate project. Drop me a note if you want to help make it into a useful module!
migajek on 12/23/2012 8:52 a.m. #
have a look at the jqGrid and Django-Tastypie. Using those two is pretty straightforward
Michał Pasternak on 12/26/2012 3:38 p.m. #