在使用DRF视图集时,往往需要配一大堆路由,例如: # views.py class DepartmentViewSet(ListModelMixin,CreateModelMixin,RetrieveModelMixin, UpdateModelMixin,DestroyModelMixin,GenericViewSet): queryset = Department.objects.all() serializer_class = DepartmentSerializer # urls.py…