From a0902b784bb6c60abe94a775a4b3cd48effbc699 Mon Sep 17 00:00:00 2001 From: fatemeh zahra Date: Wed, 18 Sep 2024 02:32:14 +0330 Subject: [PATCH] :hammer::art: refactor(templates): Update email template with new design and improved styles - Refactored the email template for log notifications to introduce a new design with updated styles. - Changed the background color to #2C333B for a darker theme, with the content area having a light background #ECE9E1. - Added a new header with a logo and branding (LAZARUS) for improved visual identity. - Included the date and ime in a more readable and prominent format. - Updated the layout to have a more modern look with rounded corners and shadow effects for better visual presentation. - Improved the structure and alignment of log message content, IP address, and browser information for clearer readability. - Retained automated message disclaimers at the bottom of the email template. Closes #85 --- django_logging/handlers/email_handler.py | 5 +- .../templates/email_notifier_template.html | 59 ++++++++++++------- 2 files changed, 42 insertions(+), 22 deletions(-) diff --git a/django_logging/handlers/email_handler.py b/django_logging/handlers/email_handler.py index f2480ff..c3644f0 100644 --- a/django_logging/handlers/email_handler.py +++ b/django_logging/handlers/email_handler.py @@ -49,10 +49,11 @@ def render_template( current_time = now() # Format date and time separately - formatted_date = current_time.strftime("%d %B %Y").replace(current_time.strftime("%B"), current_time.strftime("%B").upper()) + formatted_date = current_time.strftime("%d %B %Y").replace( + current_time.strftime("%B"), current_time.strftime("%B").upper() + ) formatted_time = current_time.strftime("%I:%M %p") - context = { "message": log_entry, "date": formatted_date, diff --git a/django_logging/templates/email_notifier_template.html b/django_logging/templates/email_notifier_template.html index eb34e0f..dda0fd1 100644 --- a/django_logging/templates/email_notifier_template.html +++ b/django_logging/templates/email_notifier_template.html @@ -4,40 +4,59 @@ Log Record Notification + + + - - + +
-
- +
+ - - + + + + - - - -
-
-
- django_logging +
+
+ + LAZARUS
+
-

Log Message:
{{ message }}

+
+ + + + + +
+ {{date}} + +

+ Email prepared at {{time}} +

+
+
+

Log Message:

+

{{ message }}

{% if ip_address != "Unknown" %} -

IP Address: {{ ip_address }}

+

IP Address:

+

{{ ip_address }}

{% endif %} {% if browser_type != "Unknown" %} -

Browser Type: {{ browser_type }}

+

Browser Type:

+

{{ browser_type }}

{% endif %} -

This email was prepared to send at {{ time }}

-

This is an automated message.

Please do not reply.

+
+

This is an automated message.

+

Please do not reply.