From 93af4b0f107a9d2ac64ec7fd9820320c8ef59a89 Mon Sep 17 00:00:00 2001 From: Nicolas ROCHE Date: Wed, 14 Apr 2021 18:02:29 +0200 Subject: [PATCH] misc: add get_admin_url to mail templates (#51685) --- wcs/mail_templates.py | 6 ++++++ wcs/templates/wcs/backoffice/mail-template.html | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/wcs/mail_templates.py b/wcs/mail_templates.py index 28774a0b2..c54152ec1 100644 --- a/wcs/mail_templates.py +++ b/wcs/mail_templates.py @@ -14,6 +14,8 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, see . +from quixote import get_publisher + from wcs.qommon import get_logger, misc from wcs.qommon.xml_storage import XmlStorableObject @@ -43,6 +45,10 @@ class MailTemplate(XmlStorableObject): XmlStorableObject.__init__(self) self.name = name + def get_admin_url(self): + base_url = get_publisher().get_backoffice_url() + return '%s/workflows/mail-templates/%s/' % (base_url, self.id) + def store(self): if self.slug is None: # set slug if it's not yet there diff --git a/wcs/templates/wcs/backoffice/mail-template.html b/wcs/templates/wcs/backoffice/mail-template.html index f3acd10df..03d40fe73 100644 --- a/wcs/templates/wcs/backoffice/mail-template.html +++ b/wcs/templates/wcs/backoffice/mail-template.html @@ -24,7 +24,7 @@

{% trans "Usage in workflows" %}