added empty action "related" to ProductViewSet
This commit is contained in:
@@ -12,7 +12,7 @@ from django.db.models import Q
|
|||||||
from rest_framework import viewsets
|
from rest_framework import viewsets
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from rest_framework.permissions import IsAuthenticatedOrReadOnly, IsAdminUser, IsAuthenticated
|
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
|
import requests
|
||||||
|
|
||||||
@@ -41,6 +41,11 @@ class ProductViewSet(viewsets.ModelViewSet):
|
|||||||
def perform_create(self, serializer):
|
def perform_create(self, serializer):
|
||||||
serializer.save(creator=self.request.user)
|
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',])
|
@api_view(['GET',])
|
||||||
@permission_classes([IsAuthenticated,])
|
@permission_classes([IsAuthenticated,])
|
||||||
|
|||||||
Reference in New Issue
Block a user