Update emails
This commit is contained in:
parent
164a712902
commit
af5bee5147
18 changed files with 481 additions and 170 deletions
20
judge/utils/email_render.py
Normal file
20
judge/utils/email_render.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
from django.template.loader import render_to_string
|
||||
from django.contrib.sites.shortcuts import get_current_site
|
||||
from django.conf import settings
|
||||
|
||||
|
||||
def render_email_message(request, contexts):
|
||||
current_site = get_current_site(request)
|
||||
email_contexts = {
|
||||
"username": request.user.username,
|
||||
"domain": current_site.domain,
|
||||
"protocol": "https" if request.is_secure() else "http",
|
||||
"site_name": settings.SITE_NAME,
|
||||
"message": None,
|
||||
"title": None,
|
||||
"button_text": "Click here",
|
||||
"url_path": None,
|
||||
}
|
||||
email_contexts.update(contexts)
|
||||
message = render_to_string("general_email.html", email_contexts)
|
||||
return message
|
Loading…
Add table
Add a link
Reference in a new issue