Browse Source

authors count added

master
Mohsen Taba 3 weeks ago
parent
commit
27f38f1406
  1. 5
      apps/hadis/views/hadis.py
  2. 6
      apps/hadis/views/info.py

5
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. بازسازی دیتای نهایی مشابه اپ ویدیو

6
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)
Loading…
Cancel
Save