Commit 66a47c30 authored by fred's avatar fred
Browse files

misc: display number of "visits" (play) of a sound

parent be628a66
from django.template import Library
from django.conf import settings
from django.core.urlresolvers import reverse
from django.db.models import Sum
from emissions.models import Emission, Episode, NewsItem, SoundFile, Focus
from panikombo.models import Topik
from panikdb.stats.models import DailyStat
from import Page
register = Library()
......@@ -136,3 +138,8 @@ def has_topik(obj):
def topik_id(obj):
return Topik.objects.get(page=obj).id
def nb_visits(obj):
t = DailyStat.objects.filter('nb_visits'))
return t['nb_visits__sum'] or '-'
......@@ -78,6 +78,7 @@ Tags :
<th>Nb d'écoutes</th>
{% if can_manage %}<th>Modifier</th>{% endif %}
{% if can_manage %}<th>Supprimer</th>{% endif %}
{% if perms.emissions.add_focus %}<th>Focus</th>{% endif %}
......@@ -91,6 +92,7 @@ Tags :
<td>{% if soundfile.format %}{{ soundfile.format }}{% else %}-{% endif %}</td>
<td>{% if soundfile.podcastable %}oui{% else %}non{% endif %}</td>
<td>{% if soundfile.fragment %}oui{% else %}non{% endif %}</td>
<td>{{ soundfile|nb_visits }}</td>
{% if can_manage %}<td><a href="sounds/{{ }}/"
class="icon-edit" title="Modifier"></a></td>{% endif %}
{% if can_manage %}<td><a href="sounds/{{ }}/remove"
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