diff --git a/products/views.py b/products/views.py index a318bcb..6954268 100644 --- a/products/views.py +++ b/products/views.py @@ -12,7 +12,7 @@ from django.db.models import Q from rest_framework import viewsets from rest_framework.response import Response from rest_framework.permissions import IsAuthenticatedOrReadOnly, IsAdminUser, IsAuthenticated -from rest_framework.decorators import api_view, permission_classes +from rest_framework.decorators import api_view, permission_classes, action import requests @@ -41,6 +41,11 @@ class ProductViewSet(viewsets.ModelViewSet): def perform_create(self, serializer): serializer.save(creator=self.request.user) + @action(detail=True, methods=['GET',]) + def related(request): + # find the most similar products + return Response(data=[]) + @api_view(['GET',]) @permission_classes([IsAuthenticated,])