本文整理汇总了Python中indico.modules.events.registration.models.registrations.Registration.find方法的典型用法代码示例。如果您正苦于以下问题:Python Registration.find方法的具体用法?Python Registration.find怎么用?Python Registration.find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类indico.modules.events.registration.models.registrations.Registration
的用法示例。
在下文中一共展示了Registration.find方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_registrations_with_tickets
# 需要导入模块: from indico.modules.events.registration.models.registrations import Registration [as 别名]
# 或者: from indico.modules.events.registration.models.registrations.Registration import find [as 别名]
def get_registrations_with_tickets(user, event):
return Registration.find(Registration.user == user,
Registration.state == RegistrationState.complete,
RegistrationForm.event_id == event.id,
RegistrationForm.tickets_enabled,
RegistrationForm.ticket_on_event_page,
~RegistrationForm.is_deleted,
~Registration.is_deleted,
_join=Registration.registration_form).all()
示例2: _checkParams
# 需要导入模块: from indico.modules.events.registration.models.registrations import Registration [as 别名]
# 或者: from indico.modules.events.registration.models.registrations.Registration import find [as 别名]
def _checkParams(self, params):
RHManageRegFormBase._checkParams(self, params)
ids = set(request.form.getlist("registration_id"))
self.registrations = (
Registration.find(Registration.id.in_(ids), ~Registration.is_deleted)
.with_parent(self.regform)
.order_by(*Registration.order_by_name)
.all()
)
示例3: _visible_registration
# 需要导入模块: from indico.modules.events.registration.models.registrations import Registration [as 别名]
# 或者: from indico.modules.events.registration.models.registrations.Registration import find [as 别名]
def _visible_registration(event):
if not event.has_feature('registration'):
return False
if RegistrationForm.find(RegistrationForm.is_scheduled, RegistrationForm.event_id == int(event.id)).count():
return True
if not session.user:
return False
return bool(Registration.find(Registration.user == session.user,
Registration.event_id == int(event.id),
~Registration.is_deleted,
~RegistrationForm.is_deleted,
_join=Registration.registration_form).count())
示例4: _process
# 需要导入模块: from indico.modules.events.registration.models.registrations import Registration [as 别名]
# 或者: from indico.modules.events.registration.models.registrations.Registration import find [as 别名]
def _process(self):
regforms = RegistrationForm.find_all(
RegistrationForm.publish_registrations_enabled, event_id=int(self.event.id)
)
query = Registration.find(
Registration.event_id == self.event.id,
RegistrationForm.publish_registrations_enabled,
~RegistrationForm.is_deleted,
~Registration.is_deleted,
_join=Registration.registration_form,
).order_by(db.func.lower(Registration.last_name), db.func.lower(Registration.first_name))
registrations = [(reg.get_full_name(), reg.get_personal_data()) for reg in query]
return self.view_class.render_template(
"display/participant_list.html",
self.event,
event=self.event,
regforms=regforms,
show_affiliation=any(pd.get("affiliation") for reg, pd in registrations),
show_position=any(pd.get("position") for reg, pd in registrations),
registrations=registrations,
)
示例5: _associate_registrations
# 需要导入模块: from indico.modules.events.registration.models.registrations import Registration [as 别名]
# 或者: from indico.modules.events.registration.models.registrations.Registration import find [as 别名]
def _associate_registrations(user, **kwargs):
from indico.modules.events.registration.models.registrations import Registration
reg_alias = db.aliased(Registration)
subquery = db.session.query(reg_alias).filter(
reg_alias.user_id == user.id,
reg_alias.registration_form_id == Registration.registration_form_id,
~reg_alias.is_deleted,
)
registrations = (
Registration.find(
Registration.user_id == None, # noqa
Registration.email.in_(user.all_emails),
~subquery.exists(),
~Registration.is_deleted,
)
.order_by(Registration.submitted_dt.desc())
.all()
)
if not registrations:
return
done = set()
for registration in registrations:
if registration.registration_form_id in done:
continue
logger.info("Associating %s with %s", registration, user)
registration.user = user
done.add(registration.registration_form_id)
db.session.flush()
num = len(done)
flash(
ngettext(
"A registration has been linked to your account.",
"{n} registrations have been linked to your account.",
num,
).format(n=num),
"info",
)
示例6: validate_email
# 需要导入模块: from indico.modules.events.registration.models.registrations import Registration [as 别名]
# 或者: from indico.modules.events.registration.models.registrations.Registration import find [as 别名]
def validate_email(self, field):
if RegistrationInvitation.find(email=field.data).with_parent(self.regform).count():
raise ValidationError(_("There is already an invitation with this email address."))
if Registration.find(email=field.data, is_active=True).with_parent(self.regform).count():
raise ValidationError(_("There is already a registration with this email address."))