Django-rest-framework: Documentation for the action decorator

Created on 6 May 2020  路  6Comments  路  Source: encode/django-rest-framework

Hello there. Sorry for not using the issue template, but I think it is not suitable in this situation.

I want to ask if there exists detailed documentation about the @action decorator. It wasn't easy to find out which arguments I can pass in it. For example, I needed to pass a serializer_class inside but found out that I can do it only after searching for issues on Github.

Documentation good first issue

All 6 comments

The documentation isn't very explicit about that:

The decorator can additionally take extra arguments that will be set for the routed view only.

Mostly, it'll take any generic view class argument but that should be stated explicitly.

I agree that the documentation isn't very explicit about that.
You can check the method docstring which provides more information : https://github.com/encode/django-rest-framework/blob/master/rest_framework/decorators.py#L123

@carltongibson I can take care of this

Thank you for your work. I think that there still exists a problem with serializer_class - the description says that all *_classes parameters are acceptable, but the parameter serializer_class doesn't fit this regular expression :)

Following your comment, I added a suggestion on #7380

Closed by #7380

Was this page helpful?
0 / 5 - 0 ratings