装饰器
-
list_route与detail_route的区别就是 list_route 的参数不包含 pk(对应 list),而 detail_route 包含pk(对应 retrieve)。看一段代码就懂了:
@list_route(methods=['post', 'delete'], url_path='') def custom_handler(self, request): pass
@detail_route(methods=['get'], url_path='') def custom_handler(self, request, pk=None): pass
网友评论