Elaborate on usage of extra arguments in @action()

This commit is contained in:
Soeren Wegener 2019-01-18 13:44:46 +01:00
parent f5c3bd0ce5
commit 0f8e3dd57d

View File

@ -168,7 +168,7 @@ A more complete example of extra actions:
serializer = self.get_serializer(recent_users, many=True)
return Response(serializer.data)
The decorator can additionally take extra arguments that will be set for the routed view only. For example:
The decorator can additionally take extra arguments that will be set for the routed view only. Any class property of the `ViewSet` is therefore a valid argument for `@action()` (e.g. `serializer_class`, `queryset`, `permission_classes`). For example:
@action(detail=True, methods=['post'], permission_classes=[IsAdminOrIsSelf])
def set_password(self, request, pk=None):