Skip to content

when getting shcema, happy an exception  #7069

@fangaofeng

Description

@fangaofeng

Checklist

version:
django 2.2
django rest framework 3.10.3

Steps to reproduce

Example code is follow:
user Autoschema

class TrainGropMemberModifyViewSet(viewsets.ModelViewSet):
    def get_serializer_class(self):
        if self.request.method == 'PATCH':
            return TrainGropListSerializer
        if self.request.method == 'PUT':
            return TrainGroupModifySerializer

Expected behavior

get shcema

Actual behavior

File "H:\trian\whlrest\traingroup\api.py", line 34, in get_serializer_class
if self.request.method == 'PATCH':
AttributeError: 'NoneType' object has no attribute 'method'

when i use drf_yasg, drf_yasg can return correct schema.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions