示例#1
0
    def _process(self):
        tpl = get_template_module(
            'events/registration/emails/custom_email_default.html')
        default_body = tpl.get_html_body()
        registration_ids = request.form.getlist('registration_id')
        form = EmailRegistrantsForm(
            body=default_body,
            regform=self.regform,
            registration_id=registration_ids,
            recipients=[x.email for x in self.registrations])
        if not self.regform.tickets_enabled:
            del form.attach_ticket
        if form.validate_on_submit():
            self._send_emails(form)
            num_emails_sent = len(self.registrations)
            flash(
                ngettext("The email was sent.", "{num} emails were sent.",
                         num_emails_sent).format(num=num_emails_sent),
                'success')
            return jsonify_data()

        registrations_without_ticket = [
            r for r in self.registrations if r.is_ticket_blocked
        ]
        return jsonify_template('events/registration/management/email.html',
                                form=form,
                                regform=self.regform,
                                all_registrations_count=len(
                                    self.registrations),
                                registrations_without_ticket_count=len(
                                    registrations_without_ticket))
示例#2
0
 def _process(self):
     tpl = get_template_module('events/registration/emails/custom_email_default.html', event=self.event)
     default_body = tpl.get_html_body()
     form = EmailRegistrantsForm(body=default_body, regform=self.regform)
     if form.validate_on_submit():
         self._send_emails(form)
         num_emails_sent = len(self.registrations)
         flash(ngettext("The email was sent.",
                        "{num} emails were sent.", num_emails_sent).format(num=num_emails_sent), 'success')
         return jsonify_data()
     return jsonify_template('events/registration/management/email.html', form=form, regform=self.regform)
示例#3
0
文件: reglists.py 项目: nyimbi/indico
 def _process(self):
     tpl = get_template_module('events/registration/emails/custom_email_default.html')
     default_body = tpl.get_html_body()
     form = EmailRegistrantsForm(body=default_body, regform=self.regform)
     if form.validate_on_submit():
         self._send_emails(form)
         num_emails_sent = len(self.registrations)
         flash(ngettext("The email was sent.",
                        "{num} emails were sent.", num_emails_sent).format(num=num_emails_sent), 'success')
         return jsonify_data()
     return jsonify_template('events/registration/management/email.html', form=form, regform=self.regform)
示例#4
0
文件: reglists.py 项目: jas01/indico
 def _process(self):
     tpl = get_template_module('events/registration/emails/custom_email_default.html')
     default_body = tpl.get_html_body()
     registration_ids = request.form.getlist('registration_id')
     form = EmailRegistrantsForm(body=default_body, regform=self.regform, registration_id=registration_ids,
                                 recipients=[x.email for x in self.registrations])
     if not self.regform.tickets_enabled:
         del form.attach_ticket
     if form.validate_on_submit():
         self._send_emails(form)
         num_emails_sent = len(self.registrations)
         flash(ngettext("The email was sent.",
                        "{num} emails were sent.", num_emails_sent).format(num=num_emails_sent), 'success')
         return jsonify_data()
     return jsonify_template('events/registration/management/email.html', form=form, regform=self.regform)