v
This commit is contained in:
1 parent
8a9a19f136
commit
cf662895e5
12 files changed
+81
-175
No files matched your search
+10
-4
@@ -23,9 +23,6 @@ class Counter(ListAPIView):
|
||||
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:
|
||||
@@ -37,7 +34,6 @@ class Counter(ListAPIView):
|
||||
|
||||
|
||||
def post(self, request):
|
||||
print('hernjaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
|
||||
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'])
|
||||
else:
|
||||
@@ -51,4 +47,14 @@ class Counter(ListAPIView):
|
||||
}
|
||||
|
||||
return Response(res)
|
||||
|
||||
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='/')
|
||||
sort = res.order_by('-count__sum')[:6]
|
||||
|
||||
|
||||
return Response(sort)
|
||||
|
||||
Reference in new issue
Block a user