diff --git a/seminar/templates/seminar/titulnistrana.html b/seminar/templates/seminar/titulnistrana.html index c6c1a522..ae949d7e 100644 --- a/seminar/templates/seminar/titulnistrana.html +++ b/seminar/templates/seminar/titulnistrana.html @@ -22,23 +22,9 @@ M&M je korespondeční seminář. Několikrát do roka zdarma vydáváme ča

Do konce odeslání řešení zbývá:
{{ted|timesince:dead}}

- - - -
{% endif %} + {# Novinky #}

Novinky

{% include 'seminar/novinky.html' %} diff --git a/seminar/views.py b/seminar/views.py index 54ed3e11..e122d163 100644 --- a/seminar/views.py +++ b/seminar/views.py @@ -72,16 +72,16 @@ class TitulniStranaView(generic.ListView): context = super(TitulniStranaView, self).get_context_data(**kwargs) nastaveni = get_object_or_404(Nastaveni) cas_deadline = nastaveni.aktualni_cislo.datum_deadline - try: - rozdil_casu = datetime.combine(cas_deadline, datetime.max.time()) \ - - datetime.now() - context['cas_do_konce_dni'] = rozdil_casu.days - context['cas_do_konce_hodin'] = rozdil_casu.seconds / 3600 - context['cas_do_konce_minut'] = (rozdil_casu.seconds / 60) % 60 - context['cas_do_konce_sekund'] = rozdil_casu.seconds % 60 - context['dead'] = datetime.combine(cas_deadline, datetime.max.time()) - context['ted'] = datetime.now() - except: + # Pokud neni zverejnene cislo nezverejnuj odpocet + if nastaveni.aktualni_cislo.verejne(): + # pokus se zjistit termin odeslani a pokud neni zadany, + # nezverejnuj odpocet + try: + context['dead'] = datetime.combine(cas_deadline, datetime.max.time()) + context['ted'] = datetime.now() + except: + context['dead'] = None + else: context['dead'] = None return context