Add new filter
This commit is contained in:
parent
a0a6578ae8
commit
7a0999a520
|
|
@ -49,6 +49,7 @@ class RelatedObjectsCountMixin(models.QuerySet):
|
|||
return self._annotate_related_objects_count().filter(q_objects)
|
||||
|
||||
def filter_all_related_gt(self, count):
|
||||
"""Queryset filter by all related objects count"""
|
||||
exp =reduce(add, [F(f"{related_object}_count") for related_object in self._get_related_objects_names()])
|
||||
return self._annotate_related_objects_count()\
|
||||
.annotate(all_related_count=exp)\
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user