|
@ -15,17 +15,22 @@ from datetime import timedelta, date, datetime |
|
|
from itertools import groupby |
|
|
from itertools import groupby |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def verejna_temata(rocnik): |
|
|
|
|
|
"""Vrací queryset zveřejněných témat v daném ročníku. |
|
|
|
|
|
""" |
|
|
|
|
|
return Problem.objects.filter(typ=Problem.TYP_TEMA, cislo_zadani__rocnik=rocnik, cislo_zadani__verejne_db=True).order_by('kod') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def AktualniZadaniView(request): |
|
|
def AktualniZadaniView(request): |
|
|
nastaveni = get_object_or_404(Nastaveni) |
|
|
nastaveni = get_object_or_404(Nastaveni) |
|
|
problemy = Problem.objects.filter(cislo_zadani=nastaveni.aktualni_cislo).filter(stav = 'zadany') |
|
|
problemy = Problem.objects.filter(cislo_zadani=nastaveni.aktualni_cislo).filter(stav = 'zadany') |
|
|
ulohy = problemy.filter(typ = 'uloha').order_by('kod') |
|
|
ulohy = problemy.filter(typ = 'uloha').order_by('kod') |
|
|
serialy = problemy.filter(typ = 'serial').order_by('kod') |
|
|
serialy = problemy.filter(typ = 'serial').order_by('kod') |
|
|
temata = problemy.filter(typ = 'tema').order_by('kod') |
|
|
|
|
|
jednorazove_problemy = [ulohy, serialy] |
|
|
jednorazove_problemy = [ulohy, serialy] |
|
|
return render(request, 'seminar/zadani/AktualniZadani.html', |
|
|
return render(request, 'seminar/zadani/AktualniZadani.html', |
|
|
{'nastaveni': nastaveni, |
|
|
{'nastaveni': nastaveni, |
|
|
'jednorazove_problemy': jednorazove_problemy, |
|
|
'jednorazove_problemy': jednorazove_problemy, |
|
|
'temata': temata, |
|
|
'temata': verejna_temata(nastaveni.aktualni_rocnik), |
|
|
}, |
|
|
}, |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
@ -33,7 +38,7 @@ def ZadaniTemataView(request): |
|
|
nastaveni = get_object_or_404(Nastaveni) |
|
|
nastaveni = get_object_or_404(Nastaveni) |
|
|
return render(request, 'seminar/zadani/Temata.html', |
|
|
return render(request, 'seminar/zadani/Temata.html', |
|
|
{ |
|
|
{ |
|
|
'temata': Problem.objects.filter(typ=Problem.TYP_TEMA, stav=Problem.STAV_ZADANY, cislo_zadani__rocnik=nastaveni.aktualni_rocnik).order_by('kod'), |
|
|
'temata': verejna_temata(nastaveni.aktualni_rocnik) |
|
|
} |
|
|
} |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
@ -190,8 +195,7 @@ class RocnikView(generic.DetailView): |
|
|
context = super(RocnikView, self).get_context_data(**kwargs) |
|
|
context = super(RocnikView, self).get_context_data(**kwargs) |
|
|
|
|
|
|
|
|
context['vysledkovka'] = vysledkovka_rocniku(context["rocnik"]) |
|
|
context['vysledkovka'] = vysledkovka_rocniku(context["rocnik"]) |
|
|
temata_v_rocniku = Problem.objects.filter(typ=Problem.TYP_TEMA, cislo_zadani__rocnik=context['rocnik']).order_by('kod') |
|
|
context['temata_v_rocniku'] = verejna_temata(context["rocnik"]) |
|
|
context['temata_v_rocniku'] = temata_v_rocniku |
|
|
|
|
|
|
|
|
|
|
|
return context |
|
|
return context |
|
|
|
|
|
|
|
|