Basic statistics.

This commit is contained in:
Jim Driessen
2017-05-02 15:25:15 +02:00
parent cbc70be451
commit 0b926a4356
12 changed files with 84 additions and 1 deletions

10
marietje/stats/views.py Normal file
View File

@ -0,0 +1,10 @@
from django.shortcuts import render
from django.db.models import Count
from songs.models import Song
from queues.models import PlaylistSong
def stats(request):
upload_stats = Song.objects.all().exclude(user_id=None).values('user__name').annotate(total=Count('id')).order_by('-total')
request_stats = PlaylistSong.objects.all().exclude(user_id=None).values('user__name').annotate(total=Count('id')).order_by('-total')
return render(request, 'stats/stats.html', {'upload_stats': upload_stats, 'request_stats': request_stats})