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
评论列表
文章目录