Commit 18e49cfa authored by fred's avatar fred

dispaly duration of soundfiles

parent defed61b
......@@ -100,3 +100,10 @@ def can_focus(object):
elif isinstance(object, SoundFile):
return True
return False
@register.filter
def as_duration(value):
if not value:
return '-'
return '%s:%02d' % (value/60, value%60)
......@@ -74,6 +74,7 @@ Tags :
<tr>
<th>Fichier</th>
<th>Titre</th>
<th>Durée</th>
<th>Format</th>
<th>Podcastable?</th>
<th>Fragment?</th>
......@@ -86,6 +87,7 @@ Tags :
<tr>
<td><a href="{{ soundfile.file.url }}">{{ soundfile|sound_filename }}</a></td>
<td>{{ soundfile.title }}</td>
<td>{{ soundfile.duration|as_duration }}</td>
<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>
......
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