From 27f38f14063b5b61e5fb28fc17ce3d99c5c644be Mon Sep 17 00:00:00 2001 From: mohsentaba Date: Sun, 28 Jun 2026 15:27:31 +0330 Subject: [PATCH] authors count added --- apps/hadis/views/hadis.py | 5 +++++ apps/hadis/views/info.py | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/apps/hadis/views/hadis.py b/apps/hadis/views/hadis.py index 92555c2..e2af447 100644 --- a/apps/hadis/views/hadis.py +++ b/apps/hadis/views/hadis.py @@ -59,12 +59,17 @@ class PinnedHadisCollectionListView(ListAPIView): status=True ).count() + # تعداد نویسنده‌ها + from apps.hadis.models import BookAuthor + authors_count = BookAuthor.objects.count() + # 3. ساختن دیکشنری info info = { "categories_count": categories_count, # "bookmarks_count": bookmarks_count, "narrators_count": narrators_count, "sources_count": sources_count, + "authors_count": authors_count, } # 4. بازسازی دیتای نهایی مشابه اپ ویدیو diff --git a/apps/hadis/views/info.py b/apps/hadis/views/info.py index 1c7b480..62dec69 100644 --- a/apps/hadis/views/info.py +++ b/apps/hadis/views/info.py @@ -3,7 +3,7 @@ from rest_framework.response import Response from rest_framework import status -from ..models import HadisSect, BookReference, Transmitters ,Hadis ,HadisCategory +from ..models import HadisSect, BookReference, Transmitters ,Hadis ,HadisCategory, BookAuthor from ..docs import hadis_info_swagger from apps.bookmark.models import Bookmark @@ -23,13 +23,15 @@ class HadisInfoView(APIView): status=True ).count() narrator_count = Transmitters.objects.count() + authors_count = BookAuthor.objects.count() data = { 'hadis_count':hadis_count, 'category_count': category_count, 'reference_count': reference_count, 'bookmark_count': bookmark_count, - 'narrator_count': narrator_count + 'narrator_count': narrator_count, + 'authors_count': authors_count } return Response(data, status=status.HTTP_200_OK)