Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Django Rest Retrieve API View with Slug

from rest_framework import generics

class FooAPI(generics.RetrieveAPIView):
    queryset = Foo.objects.all()
    serializer_class = FooSerializer
    permission_classes = (AllowAny,)
    lookup_field = 'slug'
 
PREVIOUS NEXT
Tagged: #Django #Rest #Retrieve #API #View #Slug
ADD COMMENT
Topic
Name
3+8 =