本文整理汇总了Python中wye.profiles.models.Profile.is_coordinator方法的典型用法代码示例。如果您正苦于以下问题:Python Profile.is_coordinator方法的具体用法?Python Profile.is_coordinator怎么用?Python Profile.is_coordinator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wye.profiles.models.Profile
的用法示例。
在下文中一共展示了Profile.is_coordinator方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: workshop_details
# 需要导入模块: from wye.profiles.models import Profile [as 别名]
# 或者: from wye.profiles.models.Profile import is_coordinator [as 别名]
def workshop_details(request, pk):
template_name = "workshops/workshop_detail.html"
workshop_obj = get_object_or_404(Workshop, id=pk)
show_contact_flag = False
user = request.user
if (
[u for u in workshop_obj.presenter.all() if user == u]
or [u for u in workshop_obj.requester.user.all() if user == u]
or user.is_superuser
or ((not user.is_anonymous) and Profile.is_coordinator(user))
):
show_contact_flag = True
context_dict = {"workshop": workshop_obj, "show_contact_flag": show_contact_flag}
return render(request, template_name, context_dict)
示例2: workshop_details
# 需要导入模块: from wye.profiles.models import Profile [as 别名]
# 或者: from wye.profiles.models.Profile import is_coordinator [as 别名]
def workshop_details(request, pk):
template_name = 'workshops/workshop_detail.html'
workshop_obj = get_object_or_404(Workshop, id=pk)
show_contact_flag = False
display_edit_button = False
user = request.user
user_is_presenter = [u for u in workshop_obj.presenter.all() if user == u]
user_is_requester = [
u for u in workshop_obj.requester.user.all() if user == u]
if (user_is_presenter or user_is_requester or
user.is_superuser or ((not user.is_anonymous()) and Profile.is_coordinator(user))):
show_contact_flag = True
if (user_is_presenter):
display_edit_button = True
context_dict = {
'workshop': workshop_obj,
'show_contact_flag': show_contact_flag,
'display_edit_button': display_edit_button
}
return render(request, template_name, context_dict)