Skip to content

Let model-based datatables automatically generate filter panels #131

@saemideluxe

Description

@saemideluxe

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions