ingredient related recipes performance

This commit is contained in:
vabene1111
2023-02-26 08:27:20 +01:00
parent 38010117e5
commit 1efcf386e2
2 changed files with 9 additions and 2 deletions

View File

@ -797,7 +797,10 @@ class RecipeViewSet(viewsets.ModelViewSet):
if self.detail: # if detail request and not list, private condition is verified by permission class
if not share: # filter for space only if not shared
self.queryset = self.queryset.filter(space=self.request.space).prefetch_related('steps', 'keywords',
'shared', 'steps__ingredients',
'shared',
'steps__ingredients',
'steps__ingredients__step_set',
'steps__ingredients__step_set__recipe_set',
'steps__ingredients__food',
'steps__ingredients__food__inherit_fields',
'steps__ingredients__food__supermarket_category',