euscanwww: better index
Thanks to George Prowse for the idea. Signed-off-by: Corentin Chary <corentincj@iksaif.net>
This commit is contained in:
parent
0bdd5722fd
commit
3f9d2e5599
19
euscanwww/euscan/templatetags/timedelta.py
Normal file
19
euscanwww/euscan/templatetags/timedelta.py
Normal 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)
|
@ -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 %}
|
||||||
|
Loading…
Reference in New Issue
Block a user