diff --git a/seminar/templates/seminar/titulnistrana.html b/seminar/templates/seminar/titulnistrana.html index 6a323bf9..3f0e1d82 100644 --- a/seminar/templates/seminar/titulnistrana.html +++ b/seminar/templates/seminar/titulnistrana.html @@ -1,12 +1,3 @@ - - {% extends 'base.html' %} {% load humanize %} @@ -15,23 +6,34 @@ function sousdeadline() { {% block content %} -{% if nejblizsi_deadline %} +{% if deadline_soustredeni or preddeadline or deadline %}
-

Do - {% if typ_deadline == 'soustredeni' %} - - deadlinu odeslání řešení - pro účast na soustředění - - {% elif typ_deadline == 'preddeadline' %} 1. deadlinu aktuálního čísla - {% else %} deadlinu aktuálního čísla - {% endif %}zbývá: - {{nejblizsi_deadline|timeuntil}}

+

+ + + Do konce odeslání řešení + zbývá: +

+ {% if deadline_soustredeni %} + {{deadline_soustredeni|timeuntil}} (pro + účast na soustředění) + {% endif %} +
+
+ {% if preddeadline %} + {{preddeadline|timeuntil}} (do 1. deadline) + {% endif %} +
+
+ {% if deadline %} + {{deadline|timeuntil}} (do deadline) + {% endif %} +
+
+
+

{% endif %} -
diff --git a/seminar/views/views_all.py b/seminar/views/views_all.py index ecbe82fa..43002f94 100644 --- a/seminar/views/views_all.py +++ b/seminar/views/views_all.py @@ -562,23 +562,19 @@ class TitulniStranaView(generic.ListView): context = super(TitulniStranaView, self).get_context_data(**kwargs) nastaveni = get_object_or_404(Nastaveni) - deadline_soustredeni = (nastaveni.aktualni_cislo.datum_deadline_soustredeni, "soustredeni") - preddeadline = (nastaveni.aktualni_cislo.datum_preddeadline, "preddeadline") - deadline = (nastaveni.aktualni_cislo.datum_deadline, "deadline") + context['deadline_soustredeni'] = nastaveni.aktualni_cislo.datum_deadline_soustredeni + context['preddeadline'] = nastaveni.aktualni_cislo.datum_preddeadline + context['deadline'] = nastaveni.aktualni_cislo.datum_deadline + now = date.today() + + if context['deadline_soustredeni'] is not None and context['deadline_soustredeni'] < now: + context['deadline_soustredeni'] = None + if context['preddeadline'] is not None and context['preddeadline'] < now: + context['preddeadline'] = None + if context['deadline'] is not None and context['deadline'] < now: + context['deadline'] = None - try: - nejblizsi_deadline = sorted(filter(lambda dl: dl[0] is not None and dl[0] >= date.today(), [deadline_soustredeni, preddeadline, deadline]))[0] - if nejblizsi_deadline[0] == deadline_soustredeni[0]: - nejblizsi_deadline = deadline_soustredeni - except IndexError: - nejblizsi_deadline = (None, None) # neni zadna aktualni deadline - - if nejblizsi_deadline[0] is not None: - context['nejblizsi_deadline'] = datetime.combine(nejblizsi_deadline[0], datetime.max.time()) - else: - context['nejblizsi_deadline'] = None - context['typ_deadline'] = nejblizsi_deadline[1] # Aktuální témata nazvy_a_odkazy_na_aktualni_temata = []