I would like to link "/ tags / browse" in the view, but I think the decorator forces "/ tags /: id / browse". Here is my view:
class TagViewSet(viewsets.ModelViewSet):
queryset = Tag.objects.all()
serializer_class = TagSerializer
@link(permission_classes=[])
def browse(self, request, pk=None):
...
return Response(data)
I would like to have a common CRUD API for tags, but I also add a special view that returns some aggregated data. The current @link works, but I have to go to "/ tags / 1 / browse" instead of the general "/ tags / browse". Is there an easy way to do the latter here?
(I can make a separate route, but, if possible, prefer that everything is encapsulated in this view)
Thank!
source
share