# Improves filter_show_all()
* improves performance for filter_show_all() in ShareableTableFilterMixin and CheckboxCompensationTableFilter by ~40%
This commit is contained in:
parent
35c7836b5c
commit
acee9daab8
@ -55,10 +55,12 @@ class CheckboxCompensationTableFilter(CheckboxTableFilter):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
if not value:
|
if not value:
|
||||||
return queryset.filter(
|
user_teams = self.user.shared_teams
|
||||||
|
result = queryset.filter(
|
||||||
Q(intervention__users__in=[self.user]) | # requesting user has access
|
Q(intervention__users__in=[self.user]) | # requesting user has access
|
||||||
Q(intervention__teams__in=self.user.shared_teams)
|
Q(intervention__teams__in=user_teams)
|
||||||
).distinct()
|
).distinct()
|
||||||
|
return result
|
||||||
else:
|
else:
|
||||||
return queryset
|
return queryset
|
||||||
|
|
||||||
|
@ -50,9 +50,11 @@ class ShareableTableFilterMixin(django_filters.FilterSet):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
if not value:
|
if not value:
|
||||||
return queryset.filter(
|
user_teams = self.user.shared_teams
|
||||||
|
result = queryset.filter(
|
||||||
Q(users__in=[self.user]) | # requesting user has access
|
Q(users__in=[self.user]) | # requesting user has access
|
||||||
Q(teams__in=self.user.shared_teams)
|
Q(teams__in=user_teams)
|
||||||
).distinct()
|
).distinct()
|
||||||
|
return result
|
||||||
else:
|
else:
|
||||||
return queryset
|
return queryset
|
Loading…
Reference in New Issue
Block a user