diff --git a/backend/chat/views.py b/backend/chat/views.py index b806031..1be5eeb 100644 --- a/backend/chat/views.py +++ b/backend/chat/views.py @@ -119,12 +119,12 @@ class ProductChatView(APIView): paginated_messages = paginator.paginate_queryset(formatted_messages, request) return paginator.get_paginated_response(paginated_messages) - def post(self, request, pk): + def post(self, request, slug): """ Send a new message in the product chat. """ user = request.user - product = get_object_or_404(ProductModel, id=pk) + product = get_object_or_404(ProductModel, slug=slug) chat, created = ProductChatModel.objects.get_or_create(user=user, product=product) if created: