Skip to content

Commit d70d671

Browse files
committed
products: Only let owner modify the product.
1 parent 0b3467d commit d70d671

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

products/views.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,10 @@ class ParticularProductModifyView(RetrieveUpdateDestroyAPIView):
171171
pagination_class = ResultSetPagination
172172
lookup_url_kwarg = "pid"
173173

174-
def get_queryset(self):
174+
def get_queryset(self, *args, **kwargs):
175+
user = self.request.user
175176
pid = self.kwargs.get(self.lookup_url_kwarg)
176-
product = Product.objects.filter(pid=pid)
177+
product = Product.objects.filter(artist=user, pid=pid)
177178
return product
178179

179180

0 commit comments

Comments
 (0)