def post(self, participant_id):
        participant = self.get_participant(participant_id)
        form = AcknowledgeEmailForm(request.form)
        if form.validate():
            context = {
                'participant': participant,
                'template': 'meetings/printouts/acknowledge_detail.html'
            }
            attachment = PdfRenderer('meetings/printouts/printout.html',
                                     width=ACK_W,
                                     height=ACK_H,
                                     orientation='portrait',
                                     as_attachment=True,
                                     context=context).as_attachment()
            if send_single_message(form.to.data,
                                   form.subject.data,
                                   form.message.data,
                                   attachment=attachment,
                                   attachment_name='registration_detail.pdf'):
                flash('Message successfully sent', 'success')
                return redirect(
                    url_for('.participant_detail',
                            participant_id=participant.id))
            else:
                flash('Message failed to send', 'error')

        set_language(participant.lang)
        return render_template(self.template_name,
                               participant=participant,
                               form=form)
    def post(self, participant_id):
        participant = self.get_participant(participant_id)
        form = AcknowledgeEmailForm(request.form)
        if form.validate():
            context = {"participant": participant, "template": "meetings/printouts/acknowledge_detail.html"}
            attachment = PdfRenderer(
                "meetings/printouts/printout.html",
                width=ACK_W,
                height=ACK_H,
                orientation="portrait",
                as_attachment=True,
                context=context,
            ).as_attachment()
            if send_single_message(
                form.to.data,
                form.subject.data,
                form.message.data,
                attachment=attachment,
                attachment_name="registration_detail.pdf",
            ):
                flash("Message successfully sent", "success")
                return redirect(url_for(".participant_detail", participant_id=participant.id))
            else:
                flash("Message failed to send", "error")

        set_language(participant.lang)
        return render_template(self.template_name, participant=participant, form=form)
    def post(self, mail_id):
        mail = MailLog.query.get_or_404(mail_id)
        if send_single_message(mail.to.email, mail.subject, mail.message):
            flash('Message successfully resent', 'success')
        else:
            flash('Message failed to send', 'error')

        return redirect(url_for('.mail_detail', mail_id=mail.id))
Пример #4
0
    def post(self, mail_id):
        mail = MailLog.query.get_or_404(mail_id)
        if send_single_message(mail.to.email, mail.subject, mail.message):
            flash('Message successfully resent', 'success')
        else:
            flash('Message failed to send', 'error')

        return redirect(url_for('.mail_detail',
                                mail_id=mail.id))