Exemplo n.º 1
0
    def _process(self):
        form = ImportRegistrationsForm(regform=self.regform)

        if form.validate_on_submit():
            if self.regform.is_purged:
                raise Forbidden(
                    _('Registration is disabled due to an expired retention period'
                      ))
            skip_moderation = self.regform.moderation_enabled and form.skip_moderation.data
            registrations = import_registrations_from_csv(
                self.regform,
                form.source_file.data,
                skip_moderation=skip_moderation,
                notify_users=form.notify_users.data)
            flash(
                ngettext('{} registration has been imported.',
                         '{} registrations have been imported.',
                         len(registrations)).format(len(registrations)),
                'success')
            return jsonify_data(flash=False,
                                redirect=url_for('.manage_reglist',
                                                 self.regform),
                                redirect_no_loading=True)
        return jsonify_template(
            'events/registration/management/import_registrations.html',
            form=form,
            regform=self.regform)
Exemplo n.º 2
0
    def _process(self):
        form = ImportRegistrationsForm(regform=self.regform)

        if form.validate_on_submit():
            skip_moderation = self.regform.moderation_enabled and form.skip_moderation.data
            registrations = import_registrations_from_csv(self.regform, form.source_file.data,
                                                          skip_moderation=skip_moderation,
                                                          notify_users=form.notify_users.data)
            flash(ngettext("{} registration has been imported.",
                           "{} registrations have been imported.",
                           len(registrations)).format(len(registrations)), 'success')
            return jsonify_data(flash=False, redirect=url_for('.manage_reglist', self.regform),
                                redirect_no_loading=True)
        return jsonify_template('events/registration/management/import_registrations.html', form=form,
                                regform=self.regform)
Exemplo n.º 3
0
    def _process(self):
        form = ImportRegistrationsForm(regform=self.regform)

        if form.validate_on_submit():
            registrations = import_registrations_from_csv(
                self.regform,
                form.source_file.data,
                skip_moderation=form.skip_moderation.data,
                notify_users=form.notify_users.data)
            flash(
                ngettext("{} registration has been imported.",
                         "{} registrations have been imported.",
                         len(registrations)).format(len(registrations)),
                'success')
            return jsonify_data(flash=False,
                                redirect=url_for('.manage_reglist',
                                                 self.regform),
                                redirect_no_loading=True)
        return jsonify_template(
            'events/registration/management/import_registrations.html',
            form=form,
            regform=self.regform)