当前位置: 首页>>代码示例>>Python>>正文


Python Profile.is_coordinator方法代码示例

本文整理汇总了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)
开发者ID:shankisg,项目名称:wye,代码行数:17,代码来源:views.py

示例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)
开发者ID:harisibrahimkv,项目名称:wye,代码行数:23,代码来源:views.py


注:本文中的wye.profiles.models.Profile.is_coordinator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。