📜  drf - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:56.266000             🧑  作者: Mango

代码示例1
def get_permissions(self):
    """
    Instantiates and returns the list of permissions that this view requires.
    """
    if self.action == 'list':
        permission_classes = [IsAuthenticated]
    else:
        permission_classes = [IsAdmin]
    return [permission() for permission in permission_classes]