Skip to content

Commit

Permalink
fixed shopping list recipe search
Browse files Browse the repository at this point in the history
  • Loading branch information
vabene1111 committed Nov 14, 2020
1 parent 3dad513 commit 4c92a4b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions cookbook/views/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,16 +205,15 @@ class RecipeViewSet(viewsets.ModelViewSet, StandardFilterMixin):
permission_classes = [CustomIsShare | CustomIsGuest] # TODO split read and write permission for meal plan guest

def get_queryset(self):
queryset = super().get_queryset()

internal = self.request.query_params.get('internal', None)
if internal:
queryset = queryset.filter(internal=True)
self.queryset = self.queryset.filter(internal=True)
random = self.request.query_params.get('random', False)
if random:
queryset = queryset.random(5)
self.queryset = self.queryset.random(5)

return queryset
return super().get_queryset()

# TODO write extensive tests for permissions

Expand Down

0 comments on commit 4c92a4b

Please sign in to comment.