Let model-based datatables automatically generate filter panels
The datatables already have support for automatic sorting and searching when the base model of the table is known.
In addition to that it would be very nice to have automated way to create forms for filtering. The following python package is very helpfull for exactly this task: https://django-filter.readthedocs.io/ I suggest we have two ways to specify filter fields:
- Through an additional attribute of DataTableColumn, which can be detected automatically (when the column is only a string which represents the field-name) or specified manually (same behaviour as sortingname)
- By passing one or multiple custom FilterSet to the browseview, with an additional attribute for it. Multiple FilterSets could be chained via an "or" operation
Some more information:
- The layout for the filters should be generated automatically
- The form can be accessed via a FilterSet instance (filterset.form)
- We should always set a prefix to FilterSet, so that the parameters which are passed in the URL have a prefix. This would also allow for multiple datatables on the same page to be filterable.
- The browse view is responsible for filtering
If there are multiple FilterSets for a BrowseView, should they not rather be chained with an "and" operation?
Normally the fields of a single filterset are already "and"-ed. Therefore I would combine multiple Filtersets with "or". But we could also make this configurable. There are multiple ways of how we can make filters more expressiv, but we will always be limited on the implementation of the UI. The "or"-approach would just be a way of allowing to cover a few more filter-usecases. We can also ignore multiple Filtersets for now I guess.