Skip to content

Commit

Permalink
Allow PUT request for decreasing the quantity of products.
Browse files Browse the repository at this point in the history
  • Loading branch information
damienzeng73 committed Dec 11, 2017
1 parent 1d8eeda commit 3263eaa
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions backend/cart/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ class IsOwnerOrReadOnly(permissions.BasePermission):

def has_object_permission(self, request, view, obj):
# Read permissions are allowed to any request,
# so we'll always allow GET, HEAD or OPTIONS requests.
if request.method in permissions.SAFE_METHODS:
# so we'll always allow GET, HEAD or OPTIONS requests,
# due to we need to decrease the quantity of the product,
# we'll always allow PUT requests too.
if request.method in permissions.SAFE_METHODS or request.method == 'PUT':
return True

# Write permissions are only allowed to the owner of the snippet.
Expand Down

0 comments on commit 3263eaa

Please sign in to comment.