  
      def test_exception_raised_when_action_applied_to_existing_route(self):
          class TestViewSet(viewsets.ModelViewSet):
  
              @detail_route(methods=['post'])
              def retrieve(self, request, *args, **kwargs):
                  return Response({
                      'hello': 'world'
                  })
  
 
</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=['post'])
 </s> add     @action(methods=['post'], detail=True) </s> remove     Ensure `@detail_route` decorator raises an except when applied
 </s> add     Ensure `@action` decorator raises an except when applied </s> remove     @list_route(methods=['post'])
 </s> add     @action(methods=['post'], detail=False) </s> remove     @detail_route(methods=['post'])
 </s> add     @action(methods=['post'], detail=True)
            @action(methods=['post'], detail=True)
  
      def test_exception_raised_when_action_applied_to_existing_route(self):
          class TestViewSet(viewsets.ModelViewSet):
  
            @action(methods=['post'], detail=True)
              def retrieve(self, request, *args, **kwargs):
                  return Response({
                      'hello': 'world'
                  })
  
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