diff --git a/db.sqlite3 b/db.sqlite3 index 5ad5f9df0..166cc8c41 100644 Binary files a/db.sqlite3 and b/db.sqlite3 differ diff --git a/front/package-lock.json b/front/package-lock.json index 4065a2466..f806cbcb8 100644 --- a/front/package-lock.json +++ b/front/package-lock.json @@ -1,12 +1,12 @@ { "name": "front", - "version": "0.0.14", + "version": "0.0.15", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "front", - "version": "0.0.14", + "version": "0.0.15", "dependencies": { "@fullcalendar/core": "^6.1.8", "@fullcalendar/daygrid": "^6.1.8", @@ -19,10 +19,12 @@ "@vuelidate/core": "^2.0.3", "@vuelidate/validators": "^2.0.3", "axios": "^1.4.0", + "chart.js": "^4.4.0", "date-fns": "^2.30.0", "pinia": "^2.0.23", "roboto-fontface": "*", "vue": "^3.2.0", + "vue-chartjs": "^5.2.0", "vue-jwt-decode": "^0.1.0", "vue-router": "^4.0.0", "vue-scrollto": "^2.20.0", @@ -3139,6 +3141,11 @@ "integrity": "sha512-dfLbk+PwWvFzSxwk3n5ySL0hfBog779o8h68wK/7/APo/7cgyWp5jcXockbxdk5kFRkbeXWm4Fbi9FrdN381sA==", "dev": true }, + "node_modules/@kurkle/color": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@kurkle/color/-/color-0.3.2.tgz", + "integrity": "sha512-fuscdXJ9G1qb7W8VdHi+IwRqij3lBkosAm4ydQtEmbY58OzHXqQhvlxqEkoz0yssNVn38bcpRWgA9PP+OGoisw==" + }, "node_modules/@mdi/font": { "version": "7.0.96", "resolved": "https://registry.npmjs.org/@mdi/font/-/font-7.0.96.tgz", @@ -6525,6 +6532,17 @@ "is-regex": "^1.0.3" } }, + "node_modules/chart.js": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-4.4.0.tgz", + "integrity": "sha512-vQEj6d+z0dcsKLlQvbKIMYFHd3t8W/7L2vfJIbYcfyPcRx92CsHqECpueN8qVGNlKyDcr5wBrYAYKnfu/9Q1hQ==", + "dependencies": { + "@kurkle/color": "^0.3.0" + }, + "engines": { + "pnpm": ">=7" + } + }, "node_modules/chokidar": { "version": "3.5.3", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", @@ -12845,6 +12863,15 @@ "@vue/shared": "3.3.4" } }, + "node_modules/vue-chartjs": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/vue-chartjs/-/vue-chartjs-5.2.0.tgz", + "integrity": "sha512-d3zpKmGZr2OWHQ1xmxBcAn5ShTG917+/UCLaSpaCDDqT0U7DBsvFzTs69ZnHCgKoXT55GZDW8YEj9Av+dlONLA==", + "peerDependencies": { + "chart.js": "^4.1.1", + "vue": "^3.0.0-0 || ^2.7.0" + } + }, "node_modules/vue-component-type-helpers": { "version": "1.8.8", "resolved": "https://registry.npmjs.org/vue-component-type-helpers/-/vue-component-type-helpers-1.8.8.tgz", diff --git a/front/package.json b/front/package.json index c0543f0b9..a5e16abc0 100644 --- a/front/package.json +++ b/front/package.json @@ -1,6 +1,6 @@ { "name": "front", - "version": "0.0.14", + "version": "0.0.15", "scripts": { "dev": "vite", "build": "vite build", @@ -21,10 +21,12 @@ "@vuelidate/core": "^2.0.3", "@vuelidate/validators": "^2.0.3", "axios": "^1.4.0", + "chart.js": "^4.4.0", "date-fns": "^2.30.0", "pinia": "^2.0.23", "roboto-fontface": "*", "vue": "^3.2.0", + "vue-chartjs": "^5.2.0", "vue-jwt-decode": "^0.1.0", "vue-router": "^4.0.0", "vue-scrollto": "^2.20.0", diff --git a/front/src/assets/message.jpg b/front/src/assets/message.jpg new file mode 100644 index 000000000..12e7bdcf1 Binary files /dev/null and b/front/src/assets/message.jpg differ diff --git a/front/src/assets/message.png b/front/src/assets/message.png new file mode 100644 index 000000000..06f800801 Binary files /dev/null and b/front/src/assets/message.png differ diff --git a/front/src/components/UI/Auth-form.vue b/front/src/components/UI/Auth-form.vue index 3a16fccb5..0a68c7400 100644 --- a/front/src/components/UI/Auth-form.vue +++ b/front/src/components/UI/Auth-form.vue @@ -106,11 +106,6 @@ export default { } const logging=async()=>{ - - - - - if (!v$.value.$error) { await accountStore.logging(anon) } @@ -118,9 +113,7 @@ export default { console.log(true); } } - - - + onMounted(() => { v$.value.$validate() }) diff --git a/front/src/components/UI/Calendar-full.vue b/front/src/components/UI/Calendar-full.vue index 9d8080125..adbedeec5 100644 --- a/front/src/components/UI/Calendar-full.vue +++ b/front/src/components/UI/Calendar-full.vue @@ -118,20 +118,7 @@ export default { .then(data => { for (let x in data.data) { - - // if (x =="Отпуск") { - - - // data.data[x].map(e=>{ - // let d = new Date(e.planned_date) - - // calendarOptions.events.push({ description: 'description for All Day Event', title: x, start: e.planned_date, end: new Date(d.setDate(d.getDate() + e.count_days)).toISOString().split('T')[0]}) - // } - - - // ) - // } if (x=="План-график") { data.data[x].map(e=>{ diff --git a/front/src/components/news-list-home.vue b/front/src/components/news-list-home.vue new file mode 100644 index 000000000..f020063a1 --- /dev/null +++ b/front/src/components/news-list-home.vue @@ -0,0 +1,221 @@ + + + + + \ No newline at end of file diff --git a/front/src/components/news-list.vue b/front/src/components/news-list.vue index 3bbb68948..ec28cfa55 100644 --- a/front/src/components/news-list.vue +++ b/front/src/components/news-list.vue @@ -1,30 +1,16 @@ + + {{ child.name }} + @@ -147,6 +167,12 @@ @@ -187,105 +213,9 @@ - - - - + + +
+

Добро пожаловать на портал МИ ФНС по ЦОД № 2

+

Авторизуйтесь, для получения доступа к контенту портала

+
+
-import { ref, computed } from 'vue' +import { ref, computed, onMounted} from 'vue' import uf from '@/utils/universal_functions' import { useAccountStore } from '@/store/AccountStore' import { useMainmenuStore } from '@/store/MainmenuStore' @@ -402,7 +338,12 @@ export default { { name: 'Структура', ico: 'mdi-source-branch', - path: "/structure" + submenu: [ + { + name: 'ОКиБ', + path: "/okib" + }, + ] }, { name: 'Сотрудники', @@ -446,18 +387,17 @@ export default { } ] - - - const imageSrc = computed(() => { return new URL(`@/assets/FNS-logo-xs.png`, import.meta.url).href; }) const getcard = async () => { menuGetUserDialog.value = true + } - } - + onMounted(() => { + drawer.value = accountStore.cod2user ? true : false + }) return { theme, diff --git a/front/src/router/index.js b/front/src/router/index.js index d41091178..8e36ccb96 100644 --- a/front/src/router/index.js +++ b/front/src/router/index.js @@ -14,54 +14,78 @@ const routes = [ title:"Портал МиФНС по ЦОД №2" } }, + { - path: '/structure', - name: 'StructurePage', - component: () => import('@/views/StructurePage.vue'), + path: '/okib', + name: 'OKiBPage', + component: () => import('@/views/nested_view/o_OKiB.vue'), meta:{ - title:"Структура" + title:"Отдел кадров и безопасности" } }, { path: '/providing', name: 'ProvidingActivitiesPage', component: () => import('@/views/ProvidingActivitiesPage.vue'), + meta:{ + title:"Обеспечивающая деятельность" + } }, { path: '/faq', name: 'FAQPage', component: () => import('@/views/FAQPage.vue'), - + meta:{ + title:"Часто задаваемые вопросы" + } }, { path: '/feedback', name: 'FeedbackPage', component: () => import('@/views/FeedbackPage.vue'), + meta:{ + title:"Обратная связь" + } }, { path: '/labor', name: 'LaborProtection', component: () => import('@/views/LaborProtection.vue'), + meta:{ + title:"Безопасность" + } }, { path: '/securyty', name: 'SecurityPage', component: () => import('@/views/SecurityPage.vue'), + meta:{ + title:"Охрана труда" + } }, { path: '/inspection', name: 'AboutInspectionPage', component: () => import('@/views/AboutInspectionPage.vue'), + meta:{ + title:"Об инспекции" + } }, { path: '/portal', name: 'AboutPortalPage', component: () => import('@/views/AboutPortalPage.vue'), + meta:{ + title:"О портале" + } }, { path: '/news', name: 'AboutNewsPage', component: () => import('@/views/NewsPage.vue'), + meta:{ + title:"Лента новостей" + } }, ], }, diff --git a/front/src/utils/universal_functions.js b/front/src/utils/universal_functions.js index 4f27be6a4..8b03caf31 100644 --- a/front/src/utils/universal_functions.js +++ b/front/src/utils/universal_functions.js @@ -38,17 +38,12 @@ export function checkremote(filecheck){ - - - export default str; - - export function pagecounter(){ - console.log('Загружаю данные для циферок по количеству'); + const router = useRouter() const accountStore = useAccountStore() const appStore = useAppStore() diff --git a/front/src/views/AboutInspectionPage.vue b/front/src/views/AboutInspectionPage.vue index 1c9785108..f8992a346 100644 --- a/front/src/views/AboutInspectionPage.vue +++ b/front/src/views/AboutInspectionPage.vue @@ -9,8 +9,11 @@ diff --git a/front/src/views/AboutPortalPage.vue b/front/src/views/AboutPortalPage.vue index 144e97587..0e6aa4a05 100644 --- a/front/src/views/AboutPortalPage.vue +++ b/front/src/views/AboutPortalPage.vue @@ -5,10 +5,58 @@ - О портале - + + + + + + Страница + + + Количество посещений + + + + + + {{ item.page }} + {{ item.count__sum }} + + + + + + + + + + Пользователь + + + Страница + + + Количество посещений + + + + + + {{ item.user__username }} + {{ item.page }} + {{ item.count__sum }} + + + + @@ -17,9 +65,25 @@ \ No newline at end of file diff --git a/general_vacation/admin.py b/general_vacation/admin.py index cee1e85b6..7c16564a7 100644 --- a/general_vacation/admin.py +++ b/general_vacation/admin.py @@ -15,6 +15,7 @@ class PlanCalendarAdmin(admin.ModelAdmin): list_filter = ('start_work_period', 'end_work_period') fields = ('name', 'start_work_period', 'end_work_period') - admin.site.register(GeneralVacation, GeneralVacationAdmin), admin.site.register(PlanCalendar, PlanCalendarAdmin) +admin.site.register(BasePosition) +admin.site.register(DailyRoundUp) \ No newline at end of file diff --git a/general_vacation/models.py b/general_vacation/models.py index a92731b1b..eb3e558b0 100644 --- a/general_vacation/models.py +++ b/general_vacation/models.py @@ -2,6 +2,28 @@ from django.db import models from django.conf import settings from userauth.models import DictEmployee +class BasePosition(models.Model): + name = models.CharField(verbose_name='Название', max_length=150, blank=True, db_index=True) + + class Meta: + verbose_name = "Справочник - Позиция" + verbose_name_plural = "Справочник - Позиция" + + def __str__(self): + return str(self.name) + +class DailyRoundUp(models.Model): + todaysDate = models.DateField(verbose_name='Начало рабочего периода') + user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.PROTECT, verbose_name='Сотрудник') + position = models.ForeignKey(BasePosition, on_delete=models.PROTECT, verbose_name='Позиция') + + class Meta: + verbose_name = "Ежедневный обход" + verbose_name_plural = "Ежедневный обход" + + def __str__(self): + return str(self.name) + class GeneralVacation(models.Model): CHOICES = ( ('os', 'Осн'), diff --git a/general_vacation/urls.py b/general_vacation/urls.py index cd8845de1..25473cf6b 100644 --- a/general_vacation/urls.py +++ b/general_vacation/urls.py @@ -4,4 +4,5 @@ from .views import * urlpatterns = [ path('generalvacation/', GeneralVacationAPIView.as_view(), name='generalvacation'), + path('dailyroundup/', DailyRoundUpAPIView.as_view(), name='dailyroundup'), ] \ No newline at end of file diff --git a/general_vacation/views.py b/general_vacation/views.py index 904f04bb5..3b7d4ce9c 100644 --- a/general_vacation/views.py +++ b/general_vacation/views.py @@ -1,9 +1,18 @@ +import os +from openpyxl import load_workbook +import openpyxl from rest_framework.response import Response -import datetime +from datetime import date from .serializers import * from .models import * - +import pandas as pd from rest_framework.views import APIView +from userauth.models import * +from django.shortcuts import render +from pandas.io.excel import ExcelWriter +import openpyxl as oxl +from openpyxl import Workbook +from openpyxl.styles import Font, Alignment, Side, Border class GeneralVacationAPIView(APIView): def get(self, request): @@ -21,3 +30,143 @@ class GeneralVacationAPIView(APIView): many=True # Указываем, что на вход подаётся именно набор записей ) return Response({"Отпуск": serializer_for_basecrit.data, "План-график": serializer_for_plan.data}) + +class DailyRoundUpAPIView(APIView): + + def convert_width(self, width): + """ + Конвертируем ширину столбца Excel в ширину столбца openpyxl + """ + PIXELS_PER_CHAR = 7 + return (width) / PIXELS_PER_CHAR + + def get(self, request): + user = DictEmployee.objects.using('user_directory').filter(deleted=0).values('login', 'department', 'familyname', 'name', 'parentname') + df = pd.DataFrame.from_records(user) + df['tabel'] = df['login'].str.split('-', expand = True)[1]+df['login'].str.split('-', expand = True)[2] + file_path = 'media/DailyRoundUp.xlsx' + + thins = Side(border_style="thin") + # l = pd.DataFrame(df[(df.department=='Руководство')][['tabel', 'familyname', 'name', 'parentname']]) + # l.to_excel(file_path, sheet_name="Список", index= False, header= False, startcol=2, startrow=8) + wb = Workbook() + ws = wb.active + ws.title = "Список" + ws['B2'] = 'Список сотрудников' + ws['B3'] = 'МИ ФНС России по ЦОД № 2' + ws['B4'] = 'по подразделениям' + + ws['B6'] = 'Таб.' + ws['C6'] = 'Фамилия' + ws['D6'] = 'Имя' + ws['E6'] = 'Очество' + + for col in ws.iter_cols(min_row=6, max_row=6, min_col=2, max_col=5): + for cell in col: + cell.font = Font(name='Times New Roman', size=11, bold=True) + cell.border = Border(top=thins, bottom=thins, left=thins, right=thins) + + ws['G6'] = 'Отпуск' + ws['I6'] = 'Болен' + ws['K6'] = 'Удаленка' + + for col in ws.iter_cols(min_row=6, max_row=6, min_col=2, max_col=5): + for cell in col: + cell.font = Font(name='Times New Roman', size=11, bold=True) + cell.border = Border(top=thins, bottom=thins, left=thins, right=thins) + + + ws['I1'] = 'На '+ date.today().strftime("%d.%m.%Y") + + numb = 1 + + column_widths = [29, 53, 96, 96, 112, 28, 222, 29, 148, 28, 145, 33] + for i, width in enumerate(column_widths): + column_letter = openpyxl.utils.get_column_letter(i+1) + ws.column_dimensions[column_letter].width = self.convert_width(width) + + for col in ws.iter_cols(min_row=2, max_row=5, min_col=2, max_col=5): + for cell in col: + cell.font = Font(name='Times New Roman', size=12, bold=True) + cell.alignment = Alignment(horizontal='center') + + ws['I1'].font = Font(name='Times New Roman', size=14, bold=True) + ws['I1'].alignment = Alignment(horizontal='left') + + + for x in range(3): + ws.merge_cells(start_row=2+x, start_column=2, end_row=2+x, end_column=6) + + + k=7 + for i in df['department'].unique(): + ws.cell(row = k, column = 2).value = i + ws.cell(row = k, column = 2).font = Font(name='Times New Roman', size=10, bold=True) + ws.merge_cells(start_row=k, start_column=2, end_row=k, end_column=12) + + l = pd.DataFrame(df[(df.department==i)][['tabel', 'familyname', 'name', 'parentname']]) + + + for x in range(len(l)): + k=k+1 + + ws.cell(row = k, column = 1).value = numb + ws.cell(row = k, column = 1).font = Font(name='Times New Roman', size=10, bold=True) + + ws.cell(row = k, column = 2).value = l.iloc[x]['tabel'] + ws.cell(row = k, column = 3).value = l.iloc[x]['familyname'] + ws.cell(row = k, column = 4).value = l.iloc[x]['name'] + ws.cell(row = k, column = 5).value = l.iloc[x]['parentname'] + + + for v in range(4): + ws.cell(row = k, column = 2+v).font = Font(name='Times New Roman', size=10) + ws.cell(row = k, column = 2+v).border = Border(top=thins, bottom=thins, left=thins, right=thins) + + numb=numb+1 + print(l.iloc[x]['name']) + k=k+1 + print(k, '-------------------1') + + + wb.save(file_path) + + # file_path = 'media/DailyRoundUp.xlsx' + + + return Response('') + + # with ExcelWriter(file_path, mode="a" if os.path.exists(file_path) else "w" , if_sheet_exists='replace') as writer: + # # + # for i in df['department'].unique(): + # for i in df['department'].unique(): + # k = pd.DataFrame(df[(df.department==i)][['tabel', 'familyname', 'name', 'parentname']]) + # # k.to_excel(writer,header=None,index=None) + # print(i) + # print(k) + # return Response('') + # + # + # df.to_excel(table) + + +# def all_books(request): + # file_path = 'media/DailyRoundUp.xlsx' + # workbook = load_workbook(filename=file_path) + # worksheet = workbook.active + + # books = [] + # skip_first_row = True + # for row in worksheet.iter_rows(values_only=True, min_row=2 if skip_first_row else 1): + # book = { + # 'book_id': int(row[0]), + # 'title': row[1], + # 'author': row[2], + # 'genre': row[3], + # 'year': int(row[4]), + # 'description': row[5], + # 'cover': row[6] + # } + # books.append(book) + + # return render(request, 'books.html', {'books': books}) diff --git a/media/DailyRoundUp.xlsx b/media/DailyRoundUp.xlsx new file mode 100644 index 000000000..031a5b7f9 Binary files /dev/null and b/media/DailyRoundUp.xlsx differ diff --git a/media/newsimage/2023/10/12/oladi.jpg b/media/newsimage/2023/10/12/oladi.jpg new file mode 100644 index 000000000..79c22155f Binary files /dev/null and b/media/newsimage/2023/10/12/oladi.jpg differ diff --git a/media/newsimage/message.png b/media/newsimage/message.png new file mode 100644 index 000000000..06f800801 Binary files /dev/null and b/media/newsimage/message.png differ diff --git a/navigation/views.py b/navigation/views.py index 62b253d52..efc323fee 100644 --- a/navigation/views.py +++ b/navigation/views.py @@ -26,12 +26,21 @@ class NewsAPIView(ListAPIView): permission_classes = (AllowAny,) def get(self, request): - if request.GET.get("name") == "home": - newsqueryset = News.objects.all().order_by('cdate')[:10] + if request.GET.__contains__('id'): + newsqueryset = News.objects.filter(pk=int(request.GET.get('id'))) + allnews = 1 else: newsqueryset = News.objects.all().order_by('cdate') + allnews =newsqueryset.count() + + if request.GET.get("name") == "/": + newsqueryset = newsqueryset[:10] + else: + newsqueryset =newsqueryset[int(request.GET.get("page"))*int(request.GET.get("selected")):int(request.GET.get("page"))*int(request.GET.get("selected"))+int(request.GET.get("selected"))] + result = [] - for x in newsqueryset: + + for x in newsqueryset: a=model_to_dict(x) a['link']= str(x.link.url) a['show'] = False @@ -39,15 +48,18 @@ class NewsAPIView(ListAPIView): a['author'] = model_to_dict(DictEmployee.objects.using('user_directory').get(login=x.author.username)) a['scores'] = [{"score":y.score, "user":y.author.username} for y in x.get_news.all()] a['comment'] = [{"author":model_to_dict(DictEmployee.objects.using('user_directory').get(login=k.author.username)), - "cdate":k.cdate, - "text":k.text, - "id": k.pk - } for k in x.get_comment_news.all() - ] + "cdate":k.cdate, + "text":k.text, + "id": k.pk + } for k in x.get_comment_news.all() + ] result.append(a) - - return Response(result) + if len(newsqueryset) ==1: + result[0]['showComment'] = True + + return Response({"result": result, "allnews": round(allnews/int(request.GET.get("selected")))}) + def post(self, request): if 'scores' in request.data: @@ -60,7 +72,8 @@ class NewsAPIView(ListAPIView): upd.cdate=datetime.now() upd.save() - back = [{"score":y.score, "user":y.author.id} for y in ScoreNews.objects.filter(news_id=request.data['news'])] + + back = [{"score":y.score, "user":y.author.username} for y in ScoreNews.objects.filter(news_id=request.data['news'])] if 'text' in request.data: CommentNews.objects.create(news_id=request.data['news'], author=self.request.user, text=request.data['text']) diff --git a/portal.rar b/portal.rar new file mode 100644 index 000000000..8b8d32192 Binary files /dev/null and b/portal.rar differ diff --git a/r.txt b/r.txt index 8e8aaafb5..0dae6e2c1 100644 Binary files a/r.txt and b/r.txt differ diff --git a/watcher/models.py b/watcher/models.py index 9354ee180..4195b1011 100644 --- a/watcher/models.py +++ b/watcher/models.py @@ -1,17 +1,24 @@ from django.db import models from accounts.models import User # Create your models here. +import pandas as pd + class CountVisitor(models.Model): page = models.CharField(db_index=True, max_length=255) visitdate = models.DateField() user = models.ForeignKey(User, null=True, blank=True, on_delete=models.PROTECT) count = models.IntegerField(default=0) + def __str__(self): return str(self.page) + + + class Meta: constraints = [ models.UniqueConstraint(fields=['page', 'user', 'visitdate'], name='unique appversion') ] + \ No newline at end of file diff --git a/watcher/views.py b/watcher/views.py index 68ca77afc..988dc1d2b 100644 --- a/watcher/views.py +++ b/watcher/views.py @@ -1,3 +1,4 @@ +from django.forms import model_to_dict from django.shortcuts import render from rest_framework.generics import ListAPIView from .models import * @@ -7,32 +8,46 @@ from django.views.generic import ListView from .serializers import * from datetime import date from django.db.models import Sum - +from userauth.models import * +import pandas as pd # Create your views here. class Counter(ListAPIView): permission_classes = (AllowAny,) serializer_class = CountSerializer - # def get(self, request): - # qs = CountVisitor.objects.values() - # return Response(qs) + def get(self, request): + res = CountVisitor.objects.values('page').annotate(Sum('count')) + users = CountVisitor.objects.values('page', 'user__username').annotate(Sum('count')) + outuser = DictEmployee.objects.using('user_directory').values('login', 'fio') + pUser = pd.DataFrame.from_records(users) + pOutUser = pd.DataFrame.from_records(outuser) + h = pUser.merge(pOutUser, how="left", left_on="user__username", right_on="login") + + + + + for x in users: + if x['user__username'] is not None: + x['user__username'] = h.loc[h['login']==x['user__username']]['fio'].unique()[0] + else: + x['user__username'] = 'Анонимные' + + return Response({"pages":res, "users": users}) + def post(self, request): - # print(request.data['user__id']) if request.data['user__id'] is not None: - # print("sdddddd") watch,create = CountVisitor.objects.get_or_create(user = User(id=request.data['user__id']),page=request.data['page'], visitdate=date.today()) - else: watch,create = CountVisitor.objects.get_or_create(user__id__isnull=True, page=request.data['page'], visitdate=date.today()) watch.count+=1 watch.save() - res = {"totalvisit": CountVisitor.objects.aggregate(Sum('count'))['count__sum'], - "visittoday":CountVisitor.objects.filter(visitdate=date.today()).aggregate(Sum('count'))['count__sum'], - "uniqtoday" : CountVisitor.objects.filter(visitdate=date.today()).count() - + res = {"totalvisit": CountVisitor.objects.filter(page=request.data['page']).aggregate(Sum('count'))['count__sum'], + "visittoday":CountVisitor.objects.filter(visitdate=date.today(), page=request.data['page']).aggregate(Sum('count'))['count__sum'], + "uniqtoday" : CountVisitor.objects.filter(visitdate=date.today(), page=request.data['page']).count() } + return Response(res) \ No newline at end of file