Горячие ссылки

This commit is contained in:
iriska-gri committed 2023-11-03 11:33:19 +03:00
1 parent ac04fad613
commit 22cf92c28f
5 files changed
+41 -25

No files matched your search

+2 -1
View File
@@ -34,6 +34,7 @@ class Counter(ListAPIView):
def post(self, request):
print(request.data['ico'], '----------------------------')
if request.data['user__id'] is not None:
watch,create = CountVisitor.objects.get_or_create(user = User(id=request.data['user__id']),page=request.data['page'], visitdate=date.today(), fullPath=request.data['fullPath'], ico=request.data['ico'])
else:
@@ -52,7 +53,7 @@ class SelectedLinksAPIView(ListAPIView):
def get(self, request):
user = User.objects.get(username=self.request.user)
res = CountVisitor.objects.values('page','fullPath').filter(user_id=user).annotate(Sum('count')).exclude(fullPath='/')
res = CountVisitor.objects.values('page','fullPath','ico').filter(user_id=user).annotate(Sum('count')).exclude(fullPath='/')
sort = res.order_by('-count__sum')[:6]