Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

custom-action-level configurations #130

Open
hamidrasti opened this issue Apr 15, 2022 · 4 comments
Open

custom-action-level configurations #130

hamidrasti opened this issue Apr 15, 2022 · 4 comments
Labels
Awaiting response enhancement New feature or request

Comments

@hamidrasti
Copy link

hamidrasti commented Apr 15, 2022

It is always a need for custom actions to config permissions, serializer_class, etc.. at the custom-action-level. is there any workarounds for these situations?

Thanks in advance

@hishnash
Copy link
Member

Are you hoping to be able to pre-configure that serialiser permissions checks etc for multiple actions? or are you hoping to be able to re-use existing logic as used by the provided actions such as create ,update etc?

@hishnash hishnash added enhancement New feature or request Awaiting response labels Apr 15, 2022
@hamidrasti
Copy link
Author

Just like original DRF, Also configurable for each action separately:

@action(detail=True, methods=['post'], permission_classes=[IsAdminOrIsSelf], ...)
def set_password(self, request, pk=None):
   pass

@hamidrasti
Copy link
Author

is there any option to have custom-action-level serializer_class?

@hishnash
Copy link
Member

sorry for the extremely slow response.

no not currently, as it is today custom actions just get the raw json that is being sent to them they do not attempt to parse it.

As for permission classes the permissions classes do get the action name as an augment in has_permission it is an interesting suggestion to allow overloading this on the action decorator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting response enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants