konova/intervention/filters.py
mpeltriaux d8607d9ade # 61 Filter backend
* refactors XYTableFilter classes to hold query_filter and checkbox_filter which are separate instances of django_filter.FilterSets
* improves render ability for frontend
2022-01-11 15:19:16 +01:00

32 lines
854 B
Python

"""
Author: Michel Peltriaux
Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany
Contact: michel.peltriaux@sgdnord.rlp.de
Created on: 22.07.21
"""
from konova.filters import QueryTableFilter, CheckboxTableFilter
class InterventionTableFilter:
query_filter = None
checkbox_filter = None
qs = None
def __init__(self, *args, **kwargs):
user = kwargs.get("user", None)
qs = kwargs.get("queryset", None)
request_data = kwargs.get("data", None)
self.query_filter = QueryTableFilter(
user=user,
data=request_data,
queryset=qs,
)
self.checkbox_filter = CheckboxTableFilter(
user=user,
data=request_data,
queryset=self.query_filter.qs,
)
self.qs = self.checkbox_filter.qs