Update docs/api-guide/viewsets.md

This commit is contained in:
Bruno Alla 2025-01-28 18:03:51 +00:00 committed by GitHub
parent 117c77400b
commit b739dff200
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -128,7 +128,7 @@ You may inspect these attributes to adjust behavior based on the current action.
permission_classes = [IsAdminUser]
return [permission() for permission in permission_classes]
**Note**: don't use the `action` attribute in the `get_parsers`, `get_authenticators` or `get_content_negotiator` methods, otherwise you will get an `AttributeError` error.
**Note**: the `action` attribute is not available in the `get_parsers`, `get_authenticators` and `get_content_negotiator` methods, as it is set _after_ they are called in the framework lifecycle. If you override one of these methods and try to access the `action` attribute in them, you will get an `AttributeError` error.
## Marking extra actions for routing