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

前端 未结 5 595
南笙
南笙 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 05:51

    Yes you can by adding annotation See this link for more information there are examples:

    https://docs.djangoproject.com/en/1.6/topics/auth/default/#django.contrib.auth.decorators.permission_required

提交回复
热议问题