          A description of custom action.
          """
          return super(ExampleSerializer, self).retrieve(self, request)
  
      @detail_route(methods=['post'], serializer_class=AnotherSerializerWithListFields)
      def custom_action_with_list_fields(self, request, pk):
          """
          A custom action using both list field and list serializer in the serializer.
          """
          return super(ExampleSerializer, self).retrieve(self, request)
 
</s> remove     @list_route()
 </s> add     @action(detail=False) </s> remove     @detail_route(methods=['post'], serializer_class=AnotherSerializer)
 </s> add     @action(methods=['post'], detail=True, serializer_class=AnotherSerializer) </s> remove     methods = ['get'] if (methods is None) else methods

    def decorator(func):
        func.bind_to_methods = methods
        func.detail = False
        func.kwargs = kwargs
        return func
    return decorator
 </s> add     warnings.warn(
        "`list_route` is pending deprecation and will be removed in 3.10 in favor of "
        "`action`, which accepts a `detail` bool. Use `@action(detail=False)` instead.",
        PendingDeprecationWarning, stacklevel=2
    )
    return action(methods, detail=False, **kwargs) </s> remove     @list_route(methods=['post', 'get'], serializer_class=EmptySerializer)
 </s> add     @action(methods=['post', 'get'], detail=False, serializer_class=EmptySerializer)
    @action(methods=['post'], detail=True, serializer_class=AnotherSerializerWithListFields)
          A description of custom action.
          """
          return super(ExampleSerializer, self).retrieve(self, request)
  
    @action(methods=['post'], detail=True, serializer_class=AnotherSerializerWithListFields)
      def custom_action_with_list_fields(self, request, pk):
          """
          A custom action using both list field and list serializer in the serializer.
          """
          return super(ExampleSerializer, self).retrieve(self, request)
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_schemas.py