Python rest_framework.viewsets 模块,ViewSet() 实例源码

我们从Python开源项目中,提取了以下2个代码示例,用于说明如何使用rest_framework.viewsets.ViewSet()

项目:BrewCenterAPI    作者:BrewCenter    | 项目源码 | 文件源码
def get_permissions(self):
        """Define custom permissions for different methods"""

        # at minimum require users to be authenticated
        self.permission_classes = [IsAuthenticated]
        # for PUT requests require users to be admins
        if self.request.method == 'PUT':
            self.permission_classes.append(IsAdminUser)

        return super(viewsets.ViewSet, self).get_permissions()
项目:BrewCenterAPI    作者:BrewCenter    | 项目源码 | 文件源码
def get_permissions(self):
        """Define custom permissions for different methods"""

        # at minimum require users to be authenticated
        self.permission_classes = [IsAuthenticated]
        # for PUT requests require users to be admins
        if self.request.method == 'PUT':
            self.permission_classes.append(IsAdminUser)

        return super(viewsets.ViewSet, self).get_permissions()