diff --git a/backend/product/views.py b/backend/product/views.py index 4a56668..be9e10c 100644 --- a/backend/product/views.py +++ b/backend/product/views.py @@ -22,10 +22,10 @@ class CommentView(APIView): comment_ser = CommentSerializer(data=request.data) product = get_object_or_404(ProductModel, id=pk) if comment_ser.is_valid(): - comment_ser.save(product=product) - #TODO comment_ser.save(product=product, user=request.user) + comment_ser.save(product=product, user=request.user) return Response(comment_ser.data, status=status.HTTP_201_CREATED) return Response(comment_ser.errors, status=status.HTTP_400_BAD_REQUEST) + def delete(self, request, pk): comment = get_object_or_404(CommentModel, pk=pk) if comment.user == request.user: