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


Python Registration.find_all方法代码示例

本文整理汇总了Python中indico.modules.events.registration.models.registrations.Registration.find_all方法的典型用法代码示例。如果您正苦于以下问题:Python Registration.find_all方法的具体用法?Python Registration.find_all怎么用?Python Registration.find_all使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在indico.modules.events.registration.models.registrations.Registration的用法示例。


在下文中一共展示了Registration.find_all方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_unique_published_registrations

# 需要导入模块: from indico.modules.events.registration.models.registrations import Registration [as 别名]
# 或者: from indico.modules.events.registration.models.registrations.Registration import find_all [as 别名]
def get_unique_published_registrations(event):
    """Get a list of unique published registrations for an event.

    Uniqueness is determined by associated user, so if someone has
    registered in more than one registration form in the event, they
    will be included only once.

    :param event: The Event to get registrations for
    """
    registrations = Registration.find_all(Registration.is_active,
                                          ~RegistrationForm.is_deleted,
                                          RegistrationForm.event_id == event.id,
                                          RegistrationForm.publish_registrations_enabled,
                                          _join=Registration.registration_form)

    linked_participants = {reg.user_id: reg for reg in registrations if reg.user_id is not None}
    non_linked_participants = {reg for reg in registrations if reg.user_id is None}
    return sorted(set(linked_participants.viewvalues()) | non_linked_participants,
                  key=lambda x: (x.first_name.lower(), x.last_name.lower(), x.id))
开发者ID:irek-zaripov,项目名称:indico,代码行数:21,代码来源:util.py


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