Django viewset has not attribute 'get_extra_actions'

前端 未结 6 995
盖世英雄少女心
盖世英雄少女心 2020-12-03 02:40

I am working with Django for a first time and I\'m trying to build an API and I am following some tutorials and examples and it works right, but I am running the project now

6条回答
  •  眼角桃花
    2020-12-03 03:40

    For:

    djangorestframework==3.11.0
    Django==2.2.9
    

    You need to change class SessionViewSet(APIView): to:

    from rest_framework import mixins, viewsets
    
    class SessionViewSet(mixins.ListModelMixin,
                         viewsets.GenericViewSet):
    

    To get it to work. The internals of DRF have changed a bit and the other solutions won't cut it any longer.

提交回复
热议问题