Include link_root in mail templates, and use

Instead of hardcoding www.postgresql.org, include the link_root variable
the same way we do in the global context when rendering pages, and use
that from the mail templates. Makes for a lot smoother workings in test
environments.
This commit is contained in:
Magnus Hagander
2018-06-14 16:30:13 +02:00
parent e695b9909f
commit 01f2dc496b
5 changed files with 9 additions and 5 deletions

View File

@ -9,8 +9,12 @@ from pgweb.util.helpers import template_to_string
import re
def send_template_mail(sender, receiver, subject, templatename, templateattr={}, usergenerated=False, cc=None, replyto=None, receivername=None, sendername=None):
d = {
'link_root': settings.SITE_ROOT,
}
d.update(templateattr)
send_simple_mail(sender, receiver, subject,
template_to_string(templatename, templateattr),
template_to_string(templatename, d),
usergenerated=usergenerated, cc=cc, replyto=replyto,
receivername=receivername, sendername=sendername)