Commit 22a3e999 authored by fred's avatar fred
Browse files

add view with podcast download stats

parent a45d85d1
......@@ -9,6 +9,9 @@ from django.contrib import admin
from . import search
from . import views
from .webstats.urls import urlpatterns as webstats_urlpatterns
urlpatterns = [
url(r'^$', views.home, name='home'),
url(r'^onair.json$', views.onair, name='onair'),
......@@ -54,6 +57,7 @@ urlpatterns = [
url(r'^actus.atom$', views.atom_news_feed, name='atom-feed'),
url(r'^podcasts.rss$', views.podcasts_feed, name='podcasts-feed'),
url(r'^newsletter/', include('newsletter.urls')),
url(r'^__webstats/', include(webstats_urlpatterns)),
url(r'^admin/', include(admin.site.urls)),
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
]
......
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^downloads.json$', views.downloads_json),
]
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}
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