Fix: Provide support for disabling actions in child viewsets.

This commit is contained in:
Sergey Klyuykov 2023-07-28 15:10:01 -07:00
parent 589b5dca9e
commit dd03646829

View File

@ -231,7 +231,7 @@ class SimpleRouter(BaseRouter):
""" """
bound_methods = {} bound_methods = {}
for method, action in method_map.items(): for method, action in method_map.items():
if hasattr(viewset, action): if getattr(viewset, action, None) is not None:
bound_methods[method] = action bound_methods[method] = action
return bound_methods return bound_methods