Django viewset has not attribute 'get_extra_actions'

前端 未结 6 992
盖世英雄少女心
盖世英雄少女心 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:21

    In views.py, your viewset have to inherit from viewset and use it in your viewset try code below:

    class SessionViewSet(viewsets.ModelViewSet):
        queryset = Session.objects.all()
        serializer_class = SessionSerializer
    
        def get(self, request, format=None):
            return Response("test")
    

提交回复
热议问题