This is poorly documented. In a class-based view, you can set the attribute exclude_from_schemavalue Trueto exclude the view from the documentation. Example:
from rest_framework import viewsets, mixins
class SomeViewSet(mixins...., viewsets.GenericViewSet):
exclude_from_schema = True
[...]
exclude_from_schema, , @api_view decorator, , . DRF.
, @property, exclude_from_schema . , DRF , Request, , . , , , , :
from rest_framework import viewsets, mixins, permissions
class SomeViewSet(mixins...., viewsets.GenericViewSet):
@property
def exclude_from_schema(self):
return not permissions.IsAuthenticated().has_permission(self.request,
self)
[...]
self.request - Request, , . , rest_framework.permissions , , , permission_classes, SomeViewSet.