From 3d82dd84c9924fb708048a278a32650d5f715762 Mon Sep 17 00:00:00 2001 From: Adarnof Date: Thu, 18 Feb 2016 19:42:00 +0000 Subject: [PATCH] Display newline characters in notification view --- notifications/handlers.py | 7 ++++++- stock/templates/registered/notification_view.html | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/notifications/handlers.py b/notifications/handlers.py index bdffeb33..9d11ad69 100644 --- a/notifications/handlers.py +++ b/notifications/handlers.py @@ -2,6 +2,8 @@ import logging from django.contrib.auth.models import User from .models import Notification +logger = logging.getLogger(__name__) + class NotificationHandler(logging.Handler): def emit(self, record): for user in User.objects.all(): @@ -10,5 +12,8 @@ class NotificationHandler(logging.Handler): notif.user = user notif.title = "%s [%s:%s]" % (record.levelname, record.funcName, record.lineno) notif.level = str([item[0] for item in Notification.LEVEL_CHOICES if item[1] == record.levelname][0]) - notif.message = record.getMessage() + message = record.getMessage() + message = message + "\n\n" + message = message + record.exc_text + notif.message = message notif.save() diff --git a/stock/templates/registered/notification_view.html b/stock/templates/registered/notification_view.html index 88bfb713..3c27e54b 100644 --- a/stock/templates/registered/notification_view.html +++ b/stock/templates/registered/notification_view.html @@ -13,7 +13,7 @@
{{ notif.timestamp }} {{ notif.title }}
-
{{ notif.message }}
+
{{ notif.message }}