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


Python registrations.Registration类代码示例

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


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

示例1: create_registration

def create_registration(regform, data, invitation=None, management=False, notify_user=True):
    registration = Registration(registration_form=regform, user=get_user_by_email(data['email']),
                                base_price=regform.base_price, currency=regform.currency)
    for form_item in regform.active_fields:
        if form_item.parent.is_manager_only:
            with db.session.no_autoflush:
                value = form_item.field_impl.default_value
        else:
            value = data.get(form_item.html_field_name)
        with db.session.no_autoflush:
            data_entry = RegistrationData()
            registration.data.append(data_entry)
            for attr, value in form_item.field_impl.process_form_data(registration, value).iteritems():
                setattr(data_entry, attr, value)
        if form_item.type == RegistrationFormItemType.field_pd and form_item.personal_data_type.column:
            setattr(registration, form_item.personal_data_type.column, value)
    if invitation is None:
        # Associate invitation based on email in case the user did not use the link
        with db.session.no_autoflush:
            invitation = (RegistrationInvitation
                          .find(email=data['email'], registration_id=None)
                          .with_parent(regform)
                          .first())
    if invitation:
        invitation.state = InvitationState.accepted
        invitation.registration = registration
    registration.sync_state(_skip_moderation=management)
    db.session.flush()
    notify_registration_creation(registration, notify_user)
    logger.info('New registration %s by %s', registration, session.user)
    return registration
开发者ID:belokop,项目名称:indico_bare,代码行数:31,代码来源:util.py

示例2: create_registration

def create_registration(regform, data, invitation=None, management=False, notify_user=True, skip_moderation=None):
    user = session.user if session else None
    registration = Registration(registration_form=regform, user=get_user_by_email(data['email']),
                                base_price=regform.base_price, currency=regform.currency)
    if skip_moderation is None:
        skip_moderation = management
    for form_item in regform.active_fields:
        if form_item.parent.is_manager_only:
            value = form_item.field_impl.default_value
        else:
            value = data.get(form_item.html_field_name)
        data_entry = RegistrationData()
        registration.data.append(data_entry)
        for attr, value in form_item.field_impl.process_form_data(registration, value).iteritems():
            setattr(data_entry, attr, value)
        if form_item.type == RegistrationFormItemType.field_pd and form_item.personal_data_type.column:
            setattr(registration, form_item.personal_data_type.column, value)
    if invitation is None:
        # Associate invitation based on email in case the user did not use the link
        invitation = (RegistrationInvitation
                      .find(email=data['email'], registration_id=None)
                      .with_parent(regform)
                      .first())
    if invitation:
        invitation.state = InvitationState.accepted
        invitation.registration = registration
    registration.sync_state(_skip_moderation=skip_moderation)
    db.session.flush()
    notify_registration_creation(registration, notify_user)
    logger.info('New registration %s by %s', registration, user)
    regform.event.log(EventLogRealm.management if management else EventLogRealm.participants,
                      EventLogKind.positive, 'Registration',
                      'New registration: {}'.format(registration.full_name), user, data={'Email': registration.email})
    return registration
开发者ID:bkolobara,项目名称:indico,代码行数:34,代码来源:util.py

示例3: get_registrations_with_tickets

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()
开发者ID:belokop,项目名称:indico_bare,代码行数:9,代码来源:util.py

示例4: _checkParams

 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()
     )
开发者ID:florv,项目名称:indico,代码行数:9,代码来源:reglists.py

示例5: all_recipients

    def all_recipients(self):
        """Returns all recipients of the notifications.

        This includes both explicit recipients and, if enabled,
        participants of the event.
        """
        recipients = set(self.recipients)
        if self.send_to_participants:
            recipients.update(reg.email for reg in Registration.get_all_for_event(self.event))
        recipients.discard('')  # just in case there was an empty email address somewhere
        return recipients
开发者ID:indico,项目名称:indico,代码行数:11,代码来源:reminders.py

示例6: _visible_registration

 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())
开发者ID:fph,项目名称:indico,代码行数:12,代码来源:__init__.py

示例7: get_unique_published_registrations

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,代码行数:19,代码来源:util.py

示例8: _process

 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,
     )
开发者ID:hennogous,项目名称:indico,代码行数:21,代码来源:display.py

示例9: _associate_registrations

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",
    )
开发者ID:MichelCordeiro,项目名称:indico,代码行数:38,代码来源:__init__.py

示例10: validate_email

 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."))
开发者ID:oddlord,项目名称:indico,代码行数:5,代码来源:forms.py

示例11: _checkParams

 def _checkParams(self):
     self.token = request.args['token']
     self.registration = Registration.find_first(uuid=self.token)
     if not self.registration:
         raise BadRequest
开发者ID:florv,项目名称:indico-plugins,代码行数:5,代码来源:controllers.py


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