Django Rest Framework - detail page of @detail_route

后端 未结 2 839
滥情空心
滥情空心 2021-01-18 20:11

I am ussing @detail_route on my viewsets.ModelViewSet.

class CompanyViewSet(viewsets.ModelViewSet):
    queryset = Company.objects.all()
    serializer_class         


        
2条回答
  •  野的像风
    2021-01-18 20:48

    DRF does not handle nested routes by itself, you may handle it by hand or use an extension, like drf-nested-routers, but its outdated.

    My advice : don't fight the framework, DRF is not good at playing with url-nested resources, do it another way.

提交回复
热议问题