-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
SchemaGenerator fails with message "object has no attribute 'get_serializer_class'" #4265
Comments
I am also seeing a similar error. Except, that the call to Is there any update on this one? I will try to write a failing test case ... Have you defined a serializer for this view? You should either have a |
The OP mentions an @lwm test case would definitively help get this fixed faster. |
I am getting the same error on my function based views. My view looks sort of like this @api_view(['GET', 'POST']) @authentication_classes((CustomAuthentication, )) @permission_classes((CustomPermission, )) def get_all(request): return Response(CustomSerializer(CustomModel.objects.all(), many=True).data) Before you ask, I have to support both GET and POST for legacy reasons. |
Issue is easy to re-recreate - basically when SchemaGenerator iterates through API views and any of them derived from |
I've added PR with the test and suggested fix. |
Thanks, this will definitively help |
Not sure why this issue was closed. I also have this problem, and it appears that it occurs for any view that implements |
I also have the same issue with Django 4.0 & Django Rest Framework 3.13.1
|
Hi,
I just upgraded to 3.4.0 of django-rest-framework. In my application i have a API view which doesn't have a GET method implemented only POST is there.
Now i am trying to auto generate the schema using the tutorial given. Here is my code for the schema view.
Now when i try to view this schema i am getting this error.
Here is my LogoutView class..
Am i missing something? What needs to be done to auto generate the schema?
The text was updated successfully, but these errors were encountered: