      def regex_url_path_list(self, request, *args, **kwargs):
          kwarg = self.kwargs.get('kwarg', '')
          return Response({'kwarg': kwarg})
  
      @detail_route(url_path='detail/(?P<kwarg>[0-9]{4})')
      def regex_url_path_detail(self, request, *args, **kwargs):
          pk = self.kwargs.get('pk', '')
          kwarg = self.kwargs.get('kwarg', '')
          return Response({'pk': pk, 'kwarg': kwarg})
  
 
</s> remove     @list_route(url_path='list/(?P<kwarg>[0-9]{4})')
 </s> add     @action(detail=False, url_path='list/(?P<kwarg>[0-9]{4})') </s> remove     @list_route()
 </s> add     @action(detail=False) </s> remove     @detail_route()
 </s> add     @action(detail=True) </s> remove     @list_route(url_path="list_custom-route")
 </s> add     @action(detail=False, url_path="list_custom-route") </s> remove     @detail_route(methods=['post'])
 </s> add     @action(methods=['post'], detail=True)
    @action(detail=True, url_path='detail/(?P<kwarg>[0-9]{4})')
      def regex_url_path_list(self, request, *args, **kwargs):
          kwarg = self.kwargs.get('kwarg', '')
          return Response({'kwarg': kwarg})
  
    @action(detail=True, url_path='detail/(?P<kwarg>[0-9]{4})')
      def regex_url_path_detail(self, request, *args, **kwargs):
          pk = self.kwargs.get('pk', '')
          kwarg = self.kwargs.get('kwarg', '')
          return Response({'pk': pk, 'kwarg': kwarg})
  
keep keep keep keep replace keep keep keep keep keep
 Rework dynamic list/detail actions (#5705)

* Merge list/detail route decorators into 'action'

* Merge dynamic routes, add 'detail' attribute

* Add 'ViewSet.get_extra_actions()'

* Refactor dynamic route checking & collection

* Refactor dynamic route generation

* Add 'ViewSet.detail' initkwarg

* Fixup schema test

* Add release notes for dynamic action changes

* Replace list/detail route decorators in tests

* Convert tabs to spaces in router docs

* Update docs

* Make 'detail' a required argument of 'action'

* Improve router docs 
tests/test_routers.py