-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Possible Problem Throttle #9706
Unanswered
williank
asked this question in
Potential Issue
-
The text in the documentation suggests that we can use the attribute throttle_classes=[UserRateThrottle]
In the decorator @action
, however, this does not seem to be true. Because the action decorator does not recognize the throttle_classes
.
I tested countless ways until I came to this conclusion.
https://www.django-rest-framework.org/api-guide/throttling/
It's also possible to set throttle classes for routes that are created using the
@action
decorator. Throttle classes set in this way will override any viewset level class settings.@action(detail=True, methods=["post"], throttle_classes=[UserRateThrottle]) def example_adhoc_method(request, pk=None): content = { 'status': 'request was permitted' } return Response(content)
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment