      permission_classes = [permissions.IsAuthenticatedOrReadOnly]
      filter_backends = [filters.OrderingFilter]
      serializer_class = ExampleSerializer
  
      @detail_route(methods=['post'], serializer_class=AnotherSerializer)
      def custom_action(self, request, pk):
          """
          A description of custom action.
          """
          return super(ExampleSerializer, self).retrieve(self, request)
 
</s> remove     @detail_route(methods=['post'], serializer_class=AnotherSerializerWithListFields)
 </s> add     @action(methods=['post'], detail=True, serializer_class=AnotherSerializerWithListFields) </s> remove     @list_route()
 </s> add     @action(detail=False) </s> remove             @detail_route(methods=['post'], permission_classes=[permissions.AllowAny])
 </s> add             @action(methods=['post'], detail=True, permission_classes=[permissions.AllowAny]) </s> remove         @detail_route(methods=['options', 'get'])
 </s> add         @action(methods=['options', 'get'], detail=True) </s> remove def replace_methodname(format_string, methodname):
    """
    Partially format a format_string, swapping out any
    '{methodname}' or '{methodnamehyphen}' components.
    """
    methodnamehyphen = methodname.replace('_', '-')
    ret = format_string
    ret = ret.replace('{methodname}', methodname)
    ret = ret.replace('{methodnamehyphen}', methodnamehyphen)
    return ret


 </s> add 
    @action(methods=['post'], detail=True, serializer_class=AnotherSerializer)
      permission_classes = [permissions.IsAuthenticatedOrReadOnly]
      filter_backends = [filters.OrderingFilter]
      serializer_class = ExampleSerializer
  
    @action(methods=['post'], detail=True, serializer_class=AnotherSerializer)
      def custom_action(self, request, pk):
          """
          A description of custom action.
          """
          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