Commit bd9fc61d authored by fred's avatar fred
Browse files

webstats: create stats per soundfile, not per episode

parent 22a3e999
from django.db.models import Count
from django.http import JsonResponse
from .models import PodcastLogLine
def downloads_json(request, *args, **kwargs):
qs = PodcastLogLine.objects.values('soundfile__episode').annotate(total=Count('*'))
content = {x['soundfile__episode']: x['total'] for x in qs}
qs = PodcastLogLine.objects.values('soundfile').annotate(total=Count('*'))
content = {x['soundfile']: x['total'] for x in qs}
return JsonResponse(content)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment