If I have a ModelViewSet at
/foo
is it possible to use an APIView at a url under that? Example APIView would be at
/foo/count?
I tried registering the url with Django but it didnt work except if I changed the /foo to something else?
You could use @list_route decorator
from rest_framework.decorators import list_route
class FooViewSet(viewsets.ModelViewSet):
@list_route()
def count(self, request):
...
return Response(...)
It will append new endpoint to viewset url /foo/count/ like you want
Docs about extra actions