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


Python Event.starts_between方法代码示例

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


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

示例1: get_events_with_linked_sessions

# 需要导入模块: from indico.modules.events import Event [as 别名]
# 或者: from indico.modules.events.Event import starts_between [as 别名]
def get_events_with_linked_sessions(user, from_dt=None, to_dt=None):
    """Returns a dict with keys representing event_id and the values containing
    data about the user rights for sessions within the event

    :param user: A `User`
    :param from_dt: The earliest event start time to look for
    :param to_dt: The latest event start time to look for
    """
    query = (user.in_session_acls
             .options(load_only('session_id', 'roles', 'full_access', 'read_access'))
             .options(noload('*'))
             .options(contains_eager(SessionPrincipal.session).load_only('event_id'))
             .join(Session)
             .join(Event, Event.id == Session.event_id)
             .filter(~Session.is_deleted, ~Event.is_deleted, Event.starts_between(from_dt, to_dt)))
    data = defaultdict(set)
    for principal in query:
        roles = data[principal.session.event_id]
        if 'coordinate' in principal.roles:
            roles.add('session_coordinator')
        if 'submit' in principal.roles:
            roles.add('session_submission')
        if principal.full_access:
            roles.add('session_manager')
        if principal.read_access:
            roles.add('session_access')
    return data
开发者ID:belokop,项目名称:indico_bare,代码行数:29,代码来源:util.py

示例2: get_events_created_by

# 需要导入模块: from indico.modules.events import Event [as 别名]
# 或者: from indico.modules.events.Event import starts_between [as 别名]
def get_events_created_by(user, from_dt=None, to_dt=None):
    """Gets the IDs of events created by the user

    :param user: A `User`
    :param from_dt: The earliest event start time to look for
    :param to_dt: The latest event start time to look for
    :return: A set of event ids
    """
    query = user.created_events.filter(~Event.is_deleted, Event.starts_between(from_dt, to_dt))
    return {event.id for event in query}
开发者ID:fph,项目名称:indico,代码行数:12,代码来源:util.py

示例3: get_events_managed_by

# 需要导入模块: from indico.modules.events import Event [as 别名]
# 或者: from indico.modules.events.Event import starts_between [as 别名]
def get_events_managed_by(user, from_dt=None, to_dt=None):
    """Gets the IDs of events where the user has management privs.

    :param user: A `User`
    :param from_dt: The earliest event start time to look for
    :param to_dt: The latest event start time to look for
    :return: A set of event ids
    """
    query = (user.in_event_acls
             .join(Event)
             .options(noload('user'), noload('local_group'), load_only('event_id'))
             .filter(~Event.is_deleted, Event.starts_between(from_dt, to_dt))
             .filter(EventPrincipal.has_management_role('ANY')))
    return {principal.event_id for principal in query}
开发者ID:fph,项目名称:indico,代码行数:16,代码来源:util.py

示例4: get_events_with_linked_event_persons

# 需要导入模块: from indico.modules.events import Event [as 别名]
# 或者: from indico.modules.events.Event import starts_between [as 别名]
def get_events_with_linked_event_persons(user, from_dt=None, to_dt=None):
    """Returns a list of all events for which the user is an EventPerson

    :param user: A `User`
    :param from_dt: The earliest event start time to look for
    :param to_dt: The latest event start time to look for
    """
    query = (user.event_persons
             .options(load_only('event_id'))
             .options(noload('*'))
             .join(Event, Event.id == EventPerson.event_id)
             .filter(EventPerson.event_links.any())
             .filter(~Event.is_deleted, Event.starts_between(from_dt, to_dt)))
    return {ep.event_id for ep in query}
开发者ID:fph,项目名称:indico,代码行数:16,代码来源:util.py

示例5: get_events_with_submitted_surveys

# 需要导入模块: from indico.modules.events import Event [as 别名]
# 或者: from indico.modules.events.Event import starts_between [as 别名]
def get_events_with_submitted_surveys(user, from_dt=None, to_dt=None):
    """Gets the IDs of events where the user submitted a survey.

    :param user: A `User`
    :param from_dt: The earliest event start time to look for
    :param to_dt: The latest event start time to look for
    :return: A set of event ids
    """
    # Survey submissions are not stored in links anymore, so we need to get them directly
    query = (user.survey_submissions
             .options(load_only('survey_id'))
             .options(joinedload(SurveySubmission.survey).load_only('event_id'))
             .join(Survey)
             .join(Event)
             .filter(~Survey.is_deleted, ~Event.is_deleted, Event.starts_between(from_dt, to_dt)))
    return {submission.survey.event_id for submission in query}
开发者ID:belokop,项目名称:indico_bare,代码行数:18,代码来源:util.py


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