permissions.py 文件源码

python
阅读 35 收藏 0 点赞 0 评论 0

项目:django-north 作者: peopledoc 项目源码 文件源码
def get_searched_permissions(ctypes):
    """
    Return all permissions that should exist for existing contenttypes
    """
    # This will hold the permissions we're looking for as
    # (content_type, (codename, name))

    def __get_all_permissions(options, ctype):
        # django 1.10 compatibility
        if StrictVersion(get_version()) < StrictVersion('1.10'):
            return _get_all_permissions(options, ctype)
        return _get_all_permissions(options)

    searched_perms = list()
    for ctype, klass in ctypes:
        for perm in __get_all_permissions(klass._meta, ctype):
            searched_perms.append((ctype, perm))

    return searched_perms
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号