答えて

0

のようなローカルCONFIください:

API

class apiView(viewsets.ModelViewSet) .... { 
    permission_classes =() 
    authentication_classes =() 
} 

apicrm

class apiView(viewsets.ModelViewSet) .... { 
    permission_classes = (IsAuthenticated) 
    authentication_classes = (JSONWebTokenAuthentication,) 
} 
+0

はあなたがアプリケーション内のすべてのビューセットのためにそれを作る意味しますか? – yestema

0

を私はアプリのための権限を定義するための任意のグローバル設定があるとは思いません。 私がここで考えることができるのは、適切な権限クラスを持つ基本ビュークラスを作成することです。

apiアプリ

class BaseApiViewSet(viewsets.ModelViewSet): 
    permission_classes = (AllowAny,) 

# inherit BaseApiViewSet in all other viewsets 
class ViewSet1(BaseApiViewSet): 
    # code as it is 

apicrmアプリ

class BaseApiCrmViewSet(viewsets.ModelViewSet): 
    permission_classes = (IsAuthenticated,) 

# similary, inherit from BaseApiCrmViewSet in all other viewsets 
関連する問題