From a3ba6bc783c2a39baf35379205631b0d2a5015c8 Mon Sep 17 00:00:00 2001 From: SDE Date: Fri, 9 Feb 2024 18:18:21 +0300 Subject: [PATCH] 0.12.23 timezone in chat messages --- ChatServiceApp/funcs.py | 3 +++ templates/widgets/w_message.html | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ChatServiceApp/funcs.py b/ChatServiceApp/funcs.py index ad85861..14baba2 100644 --- a/ChatServiceApp/funcs.py +++ b/ChatServiceApp/funcs.py @@ -290,6 +290,9 @@ def get_chat_page_content_html(request, receiver_id=None): from AuthApp.models import User from django.utils import timezone + msg = f'now {timezone.now()}' + print(msg) + msgs = [] try: cur_receiver = User.objects.get(id=receiver_id) diff --git a/templates/widgets/w_message.html b/templates/widgets/w_message.html index 9c3a250..5fd117b 100644 --- a/templates/widgets/w_message.html +++ b/templates/widgets/w_message.html @@ -1,6 +1,6 @@ {% load static %} {% load tt_chat %} -{#{% load tz_detect %}#} +{% load tz %}
@@ -36,7 +36,7 @@ {% endif %}
- {% if msg %}{{ msg.modifiedDT }}{% else %}{{ ticket.modifiedDT }}{% endif %} + {% if msg %}{{ msg.modifiedDT|localtime }}{% else %}{{ ticket.modifiedDT|localtime }}{% endif %}