2021-07-22 10:00:59 +02:00
|
|
|
"""
|
|
|
|
Author: Michel Peltriaux
|
|
|
|
Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany
|
|
|
|
Contact: michel.peltriaux@sgdnord.rlp.de
|
|
|
|
Created on: 22.07.21
|
|
|
|
|
|
|
|
"""
|
2022-01-12 10:11:47 +01:00
|
|
|
from konova.filters.table_filters import AbstractTableFilter, SelectionTableFilter, QueryTableFilter, CheckboxTableFilter
|
2021-07-22 10:00:59 +02:00
|
|
|
|
|
|
|
|
2022-01-12 09:23:22 +01:00
|
|
|
class InterventionTableFilter(AbstractTableFilter):
|
|
|
|
def __init__(self, user=None, *args, **kwargs):
|
|
|
|
super().__init__(*args, **kwargs)
|
|
|
|
self.user = user
|
2022-01-11 15:19:16 +01:00
|
|
|
qs = kwargs.get("queryset", None)
|
|
|
|
request_data = kwargs.get("data", None)
|
|
|
|
|
2022-01-12 09:23:22 +01:00
|
|
|
# Pipe the queryset through all needed filters
|
2022-01-12 08:56:49 +01:00
|
|
|
self.selection_filter = SelectionTableFilter(
|
2022-01-11 15:19:16 +01:00
|
|
|
data=request_data,
|
|
|
|
queryset=qs,
|
|
|
|
)
|
2022-01-12 08:56:49 +01:00
|
|
|
self.query_filter = QueryTableFilter(
|
|
|
|
data=request_data,
|
|
|
|
queryset=self.selection_filter.qs,
|
|
|
|
)
|
2022-01-11 15:19:16 +01:00
|
|
|
self.checkbox_filter = CheckboxTableFilter(
|
|
|
|
user=user,
|
|
|
|
data=request_data,
|
|
|
|
queryset=self.query_filter.qs,
|
|
|
|
)
|
|
|
|
self.qs = self.checkbox_filter.qs
|
2022-01-12 09:23:22 +01:00
|
|
|
|