From e720a511529cecdc61dc43342471c800f140f5c6 Mon Sep 17 00:00:00 2001 From: Adrian Turjak Date: Wed, 14 Feb 2018 09:41:59 +1300 Subject: [PATCH] Add notification link in email template Change-Id: Ibe0f8e4fadeb080b8e621095879a146d1f3e3abe --- adjutant/notifications/models.py | 6 +++++- adjutant/notifications/templates/notification.txt | 8 +++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/adjutant/notifications/models.py b/adjutant/notifications/models.py index e10e89d..d5b7f74 100644 --- a/adjutant/notifications/models.py +++ b/adjutant/notifications/models.py @@ -72,10 +72,14 @@ class EmailNotification(NotificationEngine): if settings.HORIZON_URL: task_url = settings.HORIZON_URL + notification_url = settings.HORIZON_URL if not task_url.endswith('/'): task_url += '/' - task_url += 'management/tasks/' + task_url += 'management/tasks/%s' % task.uuid + notification_url += ( + 'management/notifications/%s' % notification.uuid) context['task_url'] = task_url + context['notification_url'] = notification_url if notification.error: subject = "Error - %s notification" % task.task_type diff --git a/adjutant/notifications/templates/notification.txt b/adjutant/notifications/templates/notification.txt index 7782fdd..517e5d0 100644 --- a/adjutant/notifications/templates/notification.txt +++ b/adjutant/notifications/templates/notification.txt @@ -25,9 +25,11 @@ Notification details: uuid: {{ notification.uuid }} notes: {{ notification.notes|safe }} - {% if task_url %} Task link: -{{ task_url }}{{ task.uuid }} - +{{ task_url }} +{% endif %} +{% if notification.error and notification_url %} +Notification link: +{{ notification_url }} {% endif %}