'ViewSet' object has no attribute 'request' during Schema generation · Issue #4373 · encode/django-rest-framework (original) (raw)

I use get_queryset() and get_serializer_class() across almost all my apps.
Usually I follow a way from DRF documentation:

def get_serializer_class(self): if self.request.user.is_staff: return FullAccountSerializer return BasicAccountSerializer

Yesterday I update DRF version from from 3.3.3 to 3.4 and setup restframework-swagger.
It returns me: AttributeError " DriverVehiclesViewSet' object has no attribute 'request' "

.../python3.5/site-packages/rest_framework/schemas.py in get_api_endpoints
prefix=path_regex ...
.../python3.5/site-packages/rest_framework/schemas.py in get_api_endpoints
prefix=path_regex ...
.../python3.5/site-packages/rest_framework/schemas.py in get_api_endpoints
prefix=path_regex ...
.../python3.5/site-packages/rest_framework/schemas.py in get_api_endpoints
link = self.get_link(path, method, callback) ...
.../python3.5/site-packages/rest_framework/schemas.py in get_link
fields += self.get_serializer_fields(path, method, callback, view) ...
.../python3.5/site-packages/rest_framework/schemas.py in get_serializer_fields
serializer_class = view.get_serializer_class() ...
.../src/taxiback/api/v1/views/driver.py in get_serializer_class
if self.request.method in drf_permissions.SAFE_METHODS: ...

Can somebody explain me why I got it.