本文整理匯總了Python中indico.modules.events.models.events.Event.ends_after方法的典型用法代碼示例。如果您正苦於以下問題:Python Event.ends_after方法的具體用法?Python Event.ends_after怎麽用?Python Event.ends_after使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類indico.modules.events.models.events.Event
的用法示例。
在下文中一共展示了Event.ends_after方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_not_deletable_templates
# 需要導入模塊: from indico.modules.events.models.events import Event [as 別名]
# 或者: from indico.modules.events.models.events.Event import ends_after [as 別名]
def get_not_deletable_templates(obj):
"""Get all non-deletable templates for an event/category"""
not_deletable_criteria = [
DesignerTemplate.is_system_template,
DesignerTemplate.backside_template_of != None, # noqa
DesignerTemplate.ticket_for_regforms.any(RegistrationForm.event.has(Event.ends_after(now_utc())))
]
return set(DesignerTemplate.query.filter(DesignerTemplate.owner == obj, db.or_(*not_deletable_criteria)))
示例2: add_contrib_data
# 需要導入模塊: from indico.modules.events.models.events import Event [as 別名]
# 或者: from indico.modules.events.models.events.Event import ends_after [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.ends_after(dt),
Event.persons.any((EventPerson.user_id == user.id) & (has_contrib | has_subcontrib))))
for event in query:
data[event.id].add('contributor')
示例3: get_events_registered
# 需要導入模塊: from indico.modules.events.models.events import Event [as 別名]
# 或者: from indico.modules.events.models.events.Event import ends_after [as 別名]
def get_events_registered(user, dt=None):
"""Gets the IDs of events where the user is registered.
:param user: A `User`
:param dt: Only include events taking place on/after that date
: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)
.filter(Registration.is_active, ~RegistrationForm.is_deleted, ~Event.is_deleted,
Event.ends_after(dt)))
return {registration.event_id for registration in query}
示例4: add_acl_data
# 需要導入模塊: from indico.modules.events.models.events import Event [as 別名]
# 或者: from indico.modules.events.models.events.Event import ends_after [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.ends_after(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')