Compensation index view

* adds filters and table optimizations for compensation index rendering
* fixes recorded_by/checked_by confusion in intervention table
This commit is contained in:
mipel
2021-07-29 10:51:14 +02:00
parent 3eb594c1b5
commit 98e0971c4b
5 changed files with 161 additions and 27 deletions
+37
View File
@@ -0,0 +1,37 @@
"""
Author: Michel Peltriaux
Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany
Contact: michel.peltriaux@sgdnord.rlp.de
Created on: 29.07.21
"""
from django.db.models import QuerySet
from intervention.filters import InterventionTableFilter
class CompensationTableFilter(InterventionTableFilter):
""" TableFilter for compensations
Based widely on InterventionTableFilter.
Just some minor changes for Compensation model.
"""
def _filter_show_recorded(self, queryset, name, value) -> QuerySet:
""" Filters queryset depending on value of 'show_recorded' setting
Args:
queryset ():
name ():
value ():
Returns:
"""
if not value:
return queryset.filter(
intervention__recorded_on=None,
)
else:
return queryset