Haziq
Haziq

Reputation: 2288

Django Rest Swagger: 'APIGroupAction' should either include a `serializer_class` attribute, or override the `get_serializer_class()` method

I am getting this issue while integrating django-rest-swagger==2.1.2 with existing project djangorestframework==3.5.3 .

I tried using quickstart with class based views which mention serializer_class in them:

schema_view = get_swagger_view(title='Pastebin API')

then, I tried with few futhis way as wellnction based views as:

@api_view() @renderer_classes([SwaggerUIRenderer, OpenAPIRenderer]) def schema_view(request): generator = schemas.SchemaGenerator(title='Pastebin API') return response.Response(generator.get_schema(request=request))

In both cases, it is giving the same error as : 'APIGroupAction' should either include a serializer_class attribute, or override the get_serializer_class() method.

Any help regarding this will be appreciated. Edit: 'APIGroupAction' is a class based view.

Upvotes: 0

Views: 3446

Answers (1)

Sagar
Sagar

Reputation: 159

In Django rest framework > 3.0 , It is compulsory to have serializer for any View. In your case APIGroupAction is view and It has not provided any serializer . so ,

Make one serializer for APIGroupAction eg.APIGroupActionserializer and

In APIGroupAction write this line serializer_class = APIGroupActionserializer

Upvotes: 2

Related Questions