Skip to content

Commit

Permalink
11
Browse files Browse the repository at this point in the history
  • Loading branch information
fabilya committed Oct 1, 2023
1 parent a949fd2 commit 5a5fcc3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion backend/api/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ def has_object_permission(self, request, view, obj):
and request.user.is_active
and request.user == obj.author
or request.user.is_staff
)
)
8 changes: 4 additions & 4 deletions backend/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,12 @@ def download_shopping_cart(self, request):
if not user.shoppingcart.exists():
return Response(status=status.HTTP_400_BAD_REQUEST)

ingredients = IngredientAmount.objects.filter(
ingredients = (IngredientAmount.objects.filter(
recipe__shoppingcart__user=request.user
).values(
'ingredient__name',
'ingredient__measurement_unit'
).annotate(cart_amount=Sum('amount'))
'ingredients__name',
'ingredients__measurement_unit'
).annotate(amount=Sum('recipe__amount')).order_by())

today = datetime.today()
shopping_list = (
Expand Down

0 comments on commit 5a5fcc3

Please sign in to comment.