misc: add get_admin_url to mail templates (#51685)

This commit is contained in:
Nicolas Roche 2021-04-14 18:02:29 +02:00
parent 13923c5023
commit 93af4b0f10
2 changed files with 7 additions and 1 deletions

View File

@ -14,6 +14,8 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
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

View File

@ -24,7 +24,7 @@
<h3>{% trans "Usage in workflows" %}</h3>
<ul class="objects-list single-links">
{% endif %}
<li><a href="../../{{ workflow.id }}/">{{ workflow.name }}</a></li>
<li><a href="{{ workflow.get_admin_url }}">{{ workflow.name }}</a></li>
{% if forloop.last %}
</ul>
</div>