本文整理汇总了Python中mig_main.utility.Permissions.can_create_thread方法的典型用法代码示例。如果您正苦于以下问题:Python Permissions.can_create_thread方法的具体用法?Python Permissions.can_create_thread怎么用?Python Permissions.can_create_thread使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mig_main.utility.Permissions
的用法示例。
在下文中一共展示了Permissions.can_create_thread方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_permissions
# 需要导入模块: from mig_main.utility import Permissions [as 别名]
# 或者: from mig_main.utility.Permissions import can_create_thread [as 别名]
def get_permissions(user):
permission_dict=get_member_permissions(user)
is_member=False
if hasattr(user,'userprofile') and user.userprofile.is_member():
is_member=True
permission_dict.update({'can_create_thread':Permissions.can_create_thread(user),
'can_create_forum':Permissions.can_create_forum(user),
'can_comment':hasattr(user,'userprofile') and user.userprofile.is_member(),
'can_moderate':Permissions.can_create_forum(user),
'can_downvote':get_user_points(user.userprofile.memberprofile)>0 if is_member else False})
return permission_dict
示例2: create_thread
# 需要导入模块: from mig_main.utility import Permissions [as 别名]
# 或者: from mig_main.utility.Permissions import can_create_thread [as 别名]
def create_thread(request, forum_id):
if not Permissions.can_create_thread(request.user):
raise PermissionDenied()
return add_comment(request, forum_id, None)