euscanwww: better index

Thanks to George Prowse for the idea.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
This commit is contained in:
Corentin Chary 2011-04-19 11:32:48 +02:00
parent 0bdd5722fd
commit 3f9d2e5599
2 changed files with 23 additions and 2 deletions

View File

@ -0,0 +1,19 @@
from django import template
from django.utils.timesince import timesince
from datetime import datetime
register = template.Library()
def timedelta(value, arg=None):
if not value:
return ''
if arg:
cmp = arg
else:
cmp = datetime.now()
if value > cmp:
return "in %s" % timesince(cmp,value)
else:
return "%s ago" % timesince(value,cmp)
register.filter('timedelta',timedelta)

View File

@ -1,5 +1,7 @@
{% extends "_base.html" %} {% extends "_base.html" %}
{% load timedelta %}
{% block content %} {% block content %}
<h2>What's euscan ?</h2> <h2>What's euscan ?</h2>
<p> <p>
@ -17,7 +19,7 @@ euscan code source is available at <a href="http://git.iksaif.net/?p=euscan.git;
<li>Versions: {{ n_packaged }}</li> <li>Versions: {{ n_packaged }}</li>
<li>Versions not-packaged: {{ n_upstream }}</li> <li>Versions not-packaged: {{ n_upstream }}</li>
<li>Herds: {{ n_herds }}</li> <li>Herds: {{ n_herds }}</li>
<li>Maintainer: {{ n_maintainers }}</li> <li>Maintainers: {{ n_maintainers }}</li>
<li>Last scan: {{ last_scan }}</li> <li>Last scan: {{ last_scan }} ({{ last_scan|timedelta }})</li>
</ul> </ul>
{% endblock %} {% endblock %}