本文整理汇总了Python中indico.modules.events.models.events.Event.starts_between方法的典型用法代码示例。如果您正苦于以下问题:Python Event.starts_between方法的具体用法?Python Event.starts_between怎么用?Python Event.starts_between使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类indico.modules.events.models.events.Event
的用法示例。
在下文中一共展示了Event.starts_between方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_contrib_data
# 需要导入模块: from indico.modules.events.models.events import Event [as 别名]
# 或者: from indico.modules.events.models.events.Event import starts_between [as 别名]
def add_contrib_data():
has_contrib = (EventPerson.contribution_links.any(
ContributionPersonLink.contribution.has(~Contribution.is_deleted)))
has_subcontrib = EventPerson.subcontribution_links.any(
SubContributionPersonLink.subcontribution.has(db.and_(
~SubContribution.is_deleted,
SubContribution.contribution.has(~Contribution.is_deleted))))
query = (Event.query
.options(load_only('id'))
.options(noload('*'))
.filter(~Event.is_deleted,
Event.starts_between(from_dt, to_dt),
Event.persons.any((EventPerson.user_id == user.id) & (has_contrib | has_subcontrib))))
for event in query:
data[event.id].add('contributor')
示例2: get_events_registered
# 需要导入模块: from indico.modules.events.models.events import Event [as 别名]
# 或者: from indico.modules.events.models.events.Event import starts_between [as 别名]
def get_events_registered(user, from_dt=None, to_dt=None):
"""Gets the IDs of events where the user is registered.
: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.registrations
.options(load_only('event_id'))
.options(joinedload(Registration.registration_form).load_only('event_id'))
.join(Registration.registration_form)
.join(RegistrationForm.event_new)
.filter(Registration.is_active, ~RegistrationForm.is_deleted, ~Event.is_deleted,
Event.starts_between(from_dt, to_dt)))
return {registration.event_id for registration in query}
示例3: add_acl_data
# 需要导入模块: from indico.modules.events.models.events import Event [as 别名]
# 或者: from indico.modules.events.models.events.Event import starts_between [as 别名]
def add_acl_data():
query = (user.in_contribution_acls
.options(load_only('contribution_id', 'roles', 'full_access', 'read_access'))
.options(noload('*'))
.options(contains_eager(ContributionPrincipal.contribution).load_only('event_id'))
.join(Contribution)
.join(Event, Event.id == Contribution.event_id)
.filter(~Contribution.is_deleted, ~Event.is_deleted, Event.starts_between(from_dt, to_dt)))
for principal in query:
roles = data[principal.contribution.event_id]
if 'submit' in principal.roles:
roles.add('contribution_submission')
if principal.full_access:
roles.add('contribution_manager')
if principal.read_access:
roles.add('contribution_access')
示例4: _process
# 需要导入模块: from indico.modules.events.models.events import Event [as 别名]
# 或者: from indico.modules.events.models.events.Event import starts_between [as 别名]
def _process(self):
if not request.is_xhr:
return WPCategory.render_template('display/calendar.html', self.category,
start_dt=request.args.get('start_dt'))
tz = self.category.display_tzinfo
start = tz.localize(dateutil.parser.parse(request.args['start'])).astimezone(utc)
end = tz.localize(dateutil.parser.parse(request.args['end'])).astimezone(utc)
query = (Event.query
.filter(Event.starts_between(start, end),
Event.is_visible_in(self.category),
~Event.is_deleted)
.options(load_only('id', 'title', 'start_dt', 'end_dt', 'category_id')))
events = self._get_event_data(query)
ongoing_events = (Event.query
.filter(Event.is_visible_in(self.category),
Event.start_dt < start,
Event.end_dt > end)
.options(load_only('id', 'title', 'start_dt', 'end_dt', 'timezone'))
.order_by(Event.title)
.all())
return jsonify_data(flash=False, events=events, ongoing_event_count=len(ongoing_events),
ongoing_events_html=self._render_ongoing_events(ongoing_events))