From af00d1a54b164873d7901d522501a704972613cc Mon Sep 17 00:00:00 2001 From: SDE Date: Sun, 3 Dec 2023 13:32:21 +0300 Subject: [PATCH] 0.8.25 profile unredeaded messages --- AuthApp/funcs.py | 3 +++ ChatServiceApp/funcs.py | 7 +++++++ templates/blocks/profile/b_profile_first_page.html | 7 ++++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/AuthApp/funcs.py b/AuthApp/funcs.py index 13eb757..c2f226e 100644 --- a/AuthApp/funcs.py +++ b/AuthApp/funcs.py @@ -2,7 +2,10 @@ from django.template.loader import render_to_string def get_dashboard_page_content_html(request): + from ChatServiceApp.funcs import get_unanswered_msgs_count_for_user + Dict = { + 'unanswered_msgs_count': get_unanswered_msgs_count_for_user(request.user) } html = render_to_string('blocks/profile/b_profile_first_page.html', Dict, request=request) diff --git a/ChatServiceApp/funcs.py b/ChatServiceApp/funcs.py index e1a62b5..d31483b 100644 --- a/ChatServiceApp/funcs.py +++ b/ChatServiceApp/funcs.py @@ -13,6 +13,13 @@ from datetime import datetime, time from django.conf import settings + +def get_unanswered_msgs_count_for_user(user): + msgs = Message.objects.filter(receiver=user, status='sended', group=None) + return msgs.count() + + + def get_update_chat_Dict(data): from AuthApp.models import User diff --git a/templates/blocks/profile/b_profile_first_page.html b/templates/blocks/profile/b_profile_first_page.html index 788d74f..e8313f7 100644 --- a/templates/blocks/profile/b_profile_first_page.html +++ b/templates/blocks/profile/b_profile_first_page.html @@ -21,5 +21,10 @@ {#
{% translate "Если хотите отправить посылку - зарегистрируйтесь, как отправитель" %}
#}
{% translate "Если у Вас возникнут вопросы Вы можете связаться с нами:" %} support@twb.com
-{#
{% translate "У Вас" %} {% translate "три " %}{% translate "новых сообщения." %} {% translate "Посмотреть" %}
#} +
+ {% blocktrans %}У Вас {{ unanswered_msgs_count }} новых сообщений{% endblocktrans %} + + + {% translate "Посмотреть" %} +
{#
{% translate "Хотите получать уведомление о появлении посылок?" %} {% translate "Заполните форму" %}
#} \ No newline at end of file