def mail_from_notification(self, message): title = message.title.to_text() details = self.find_details(message.details) longtext = message.longtext.to_text(collect_urls=True, initial_indent=2) actions = self.find_actions(message.actions) return render_template('notifications/email.txt', title=title, details=details, longtext=longtext, actions=actions)
def send_notification_template(type, template_name, user=Ellipsis, **context): """Like `send_notification` but renders a template instead.""" notification = render_template(template_name, **context) send_notification(type, notification, user)
def __unicode__(self): """Render the template.""" return render_template(self.template, widget=self)