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

'ViewSet' object has no attribute 'request' during Schema generation #4373

Closed
Skorpyon opened this issue Aug 10, 2016 · 0 comments
Closed

'ViewSet' object has no attribute 'request' during Schema generation #4373

Skorpyon opened this issue Aug 10, 2016 · 0 comments
Labels
Milestone

Comments

@Skorpyon
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants