def staff_reminder(request): # pylint: disable=invalid-name
if config.STAFF_EMAIL_REMINDER:
request_type = type(request).__name__.lower()
staff_url = "/email/template/{}/staff/reminder/".format(
request_type
)
context = {
request_type: request,
"protocol": "https",
"site": Site.objects.get(id=SITE_ID),
"FELLOWS_MANAGEMENT_EMAIL": config.FELLOWS_MANAGEMENT_EMAIL,
}
flatemail = FlatPage.objects.get(url=staff_url)
template = Template(flatemail.content)
jinja_context = Context(context)
html = template.render(jinja_context)
plain_text = html2text(html)
mail_staffs(
flatemail.title,
plain_text,
html_message=html,
fail_silently=False
)
评论列表
文章目录