mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-08 15:48:27 -05:00
fix loading children in treeselect
This commit is contained in:
@@ -729,9 +729,8 @@ class RecipeFacet():
|
|||||||
return self.get_facets()
|
return self.get_facets()
|
||||||
|
|
||||||
def _recipe_count_queryset(self, field, depth=1, steplen=4):
|
def _recipe_count_queryset(self, field, depth=1, steplen=4):
|
||||||
return Recipe.objects.filter(**{f'{field}__path__startswith': OuterRef('path')}, id__in=self._recipe_list, space=self._request.space
|
return Recipe.objects.filter(**{f'{field}__path__startswith': OuterRef('path'), f'{field}__depth__gte': depth}, id__in=self._recipe_list, space=self._request.space
|
||||||
).values(child=Substr(f'{field}__path', 1, steplen*depth)
|
).annotate(count=Coalesce(Func('pk', function='Count'), 0)).values('count')
|
||||||
).annotate(count=Count('pk', distinct=True)).values('count')
|
|
||||||
|
|
||||||
def _keyword_queryset(self, queryset, keyword=None):
|
def _keyword_queryset(self, queryset, keyword=None):
|
||||||
depth = getattr(keyword, 'depth', 0) + 1
|
depth = getattr(keyword, 'depth', 0) + 1
|
||||||
|
|||||||
Reference in New Issue
Block a user