# 61 Filter frontend
* optimizes minor parts of table-filter initialization and queryset passing
This commit is contained in:
parent
524b5c340f
commit
87f11a9914
@ -67,7 +67,8 @@ class CompensationTable(BaseTable):
|
|||||||
data=request.GET,
|
data=request.GET,
|
||||||
queryset=qs,
|
queryset=qs,
|
||||||
)
|
)
|
||||||
super().__init__(request, self.filter, *args, **kwargs)
|
kwargs["queryset"] = self.filter.qs
|
||||||
|
super().__init__(request, *args, **kwargs)
|
||||||
|
|
||||||
def render_id(self, value, record: Compensation):
|
def render_id(self, value, record: Compensation):
|
||||||
""" Renders the id column for a compensation
|
""" Renders the id column for a compensation
|
||||||
@ -207,7 +208,8 @@ class EcoAccountTable(BaseTable):
|
|||||||
data=request.GET,
|
data=request.GET,
|
||||||
queryset=qs,
|
queryset=qs,
|
||||||
)
|
)
|
||||||
super().__init__(request, self.filter, *args, **kwargs)
|
kwargs["queryset"] = self.filter.qs
|
||||||
|
super().__init__(request, *args, **kwargs)
|
||||||
|
|
||||||
def render_id(self, value, record: EcoAccount):
|
def render_id(self, value, record: EcoAccount):
|
||||||
""" Renders the id column for an eco account
|
""" Renders the id column for an eco account
|
||||||
|
@ -65,7 +65,8 @@ class EmaTable(BaseTable):
|
|||||||
data=request.GET,
|
data=request.GET,
|
||||||
queryset=qs,
|
queryset=qs,
|
||||||
)
|
)
|
||||||
super().__init__(request, self.filter, *args, **kwargs)
|
kwargs["queryset"] = self.filter.qs
|
||||||
|
super().__init__(request, *args, **kwargs)
|
||||||
|
|
||||||
def render_id(self, value, record: Ema):
|
def render_id(self, value, record: Ema):
|
||||||
""" Renders the id column for a EMA
|
""" Renders the id column for a EMA
|
||||||
|
@ -21,4 +21,3 @@ class InterventionTableFilter(AbstractTableFilter, GeoReferencedTableFilterMixin
|
|||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
@ -71,7 +71,8 @@ class InterventionTable(BaseTable):
|
|||||||
data=request.GET,
|
data=request.GET,
|
||||||
queryset=qs,
|
queryset=qs,
|
||||||
)
|
)
|
||||||
super().__init__(request, self.filter, *args, **kwargs)
|
kwargs["queryset"] = self.filter.qs
|
||||||
|
super().__init__(request, *args, **kwargs)
|
||||||
|
|
||||||
def render_id(self, value, record: Intervention):
|
def render_id(self, value, record: Intervention):
|
||||||
""" Renders the id column for an intervention
|
""" Renders the id column for an intervention
|
||||||
|
@ -31,10 +31,8 @@ class BaseTable(tables.tables.Table):
|
|||||||
"class": "table table-hover table-responsive-md table-responsive-sm",
|
"class": "table table-hover table-responsive-md table-responsive-sm",
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, request: HttpRequest = None, filter_set=None, queryset=None, *args, **kwargs):
|
def __init__(self, request: HttpRequest = None, queryset=None, *args, **kwargs):
|
||||||
self.user = request.user or None
|
self.user = request.user or None
|
||||||
if filter_set is not None:
|
|
||||||
queryset = filter_set.qs
|
|
||||||
kwargs["data"] = queryset
|
kwargs["data"] = queryset
|
||||||
kwargs["request"] = request
|
kwargs["request"] = request
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
Loading…
Reference in New Issue
Block a user