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 8421d57..4482f52 100644 --- a/templates/blocks/profile/b_profile_first_page.html +++ b/templates/blocks/profile/b_profile_first_page.html @@ -21,5 +21,10 @@ {#