django-rest-framework: add additional permission in ViewSet update method

前端 未结 5 603
南笙
南笙 2020-12-18 05:22

I have the following code:

class UsersViewSet(viewsets.ModelViewSet):
    model = Users
    permission_classes = (IsAuthenticated,)

    def update(self, re         


        
5条回答
  •  被撕碎了的回忆
    2020-12-18 06:04

    For me, get_permissions worked but it did turn out that if you sending in Authorization in your header in your request rest framework will throw an error even if permission is set to AllowAny. If you are going to use both authorization and AllowAny you need to have to take this into consideration.

提交回复
热议问题