humanize odpocet

This commit is contained in:
Bc. Petr Pecha 2015-09-13 17:36:01 +02:00
parent 41cf2c945e
commit f1484662ec
3 changed files with 11 additions and 1 deletions

View file

@ -106,6 +106,7 @@ INSTALLED_APPS = (
'django_comments', 'django_comments',
'django.contrib.flatpages', 'django.contrib.flatpages',
'django.contrib.humanize',
# MaMweb # MaMweb
'mamweb', 'mamweb',

View file

@ -1,5 +1,7 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% load humanize %}
{% block content %} {% block content %}
@ -12,7 +14,10 @@
<div class="odpocet"> <div class="odpocet">
Do konce odeslání řešení zbývá: Do konce odeslání řešení zbývá:
{# TODO humanize #}
{{ted|timesince:dead}}
<!--
{{cas_do_konce_dni}} dní {{cas_do_konce_dni}} dní
{% if cas_do_konce_dni < 5 %} {% if cas_do_konce_dni < 5 %}
{{cas_do_konce_hodin}} hodin {{cas_do_konce_hodin}} hodin
@ -23,6 +28,8 @@
{% endif %} {% endif %}
{% endif %} {% endif %}
{% endif %} {% endif %}
-->
</div> </div>
<p> <center> <p> <center>

View file

@ -54,6 +54,8 @@ class TitulniStranaView(generic.ListView):
context['cas_do_konce_hodin'] = rozdil_casu.seconds / 3600 context['cas_do_konce_hodin'] = rozdil_casu.seconds / 3600
context['cas_do_konce_minut'] = (rozdil_casu.seconds / 60) % 60 context['cas_do_konce_minut'] = (rozdil_casu.seconds / 60) % 60
context['cas_do_konce_sekund'] = rozdil_casu.seconds % 60 context['cas_do_konce_sekund'] = rozdil_casu.seconds % 60
context['dead'] = datetime.combine(cas_deadline, datetime.max.time())
context['ted'] = datetime.now()
return context return context
class StareNovinkyView(generic.ListView): class StareNovinkyView(generic.ListView):