|
@ -20,7 +20,7 @@ from treenode import treelib |
|
|
import treenode.templatetags as tnltt |
|
|
import treenode.templatetags as tnltt |
|
|
import treenode.serializers as vr |
|
|
import treenode.serializers as vr |
|
|
from vysledkovky.utils import body_resitelu, VysledkovkaCisla, \ |
|
|
from vysledkovky.utils import body_resitelu, VysledkovkaCisla, \ |
|
|
VysledkovkaRocniku |
|
|
VysledkovkaRocniku, VysledkovkaDoTeXu |
|
|
|
|
|
|
|
|
from datetime import date, datetime |
|
|
from datetime import date, datetime |
|
|
from django.utils import timezone |
|
|
from django.utils import timezone |
|
@ -438,7 +438,6 @@ class CisloView(generic.DetailView): |
|
|
|
|
|
|
|
|
cislo = context['cislo'] |
|
|
cislo = context['cislo'] |
|
|
context['prevcislo'] = Cislo.objects.filter((Q(rocnik__lt=self.object.rocnik) | Q(poradi__lt=self.object.poradi))&Q(rocnik__lte=self.object.rocnik)).first() |
|
|
context['prevcislo'] = Cislo.objects.filter((Q(rocnik__lt=self.object.rocnik) | Q(poradi__lt=self.object.poradi))&Q(rocnik__lte=self.object.rocnik)).first() |
|
|
context['vysledkovka'] = VysledkovkaCisla(cislo, not self.request.user.je_org) |
|
|
|
|
|
|
|
|
|
|
|
deadliny = Deadline.objects.filter(cislo=cislo).reverse() |
|
|
deadliny = Deadline.objects.filter(cislo=cislo).reverse() |
|
|
deadliny_s_vysledkovkami = [] |
|
|
deadliny_s_vysledkovkami = [] |
|
@ -506,6 +505,60 @@ class CisloVysledkovkaView(CisloView): |
|
|
content_type = 'text/plain; charset=UTF8' |
|
|
content_type = 'text/plain; charset=UTF8' |
|
|
#vypise na stranku textovy obsah vyTeXane vysledkovky k okopirovani |
|
|
#vypise na stranku textovy obsah vyTeXane vysledkovky k okopirovani |
|
|
|
|
|
|
|
|
|
|
|
def get_context_data(self, **kwargs): |
|
|
|
|
|
context = super(CisloVysledkovkaView, self).get_context_data() |
|
|
|
|
|
cislo = context['cislo'] |
|
|
|
|
|
|
|
|
|
|
|
cislopred = cislo.predchozi() |
|
|
|
|
|
if cislopred is not None: |
|
|
|
|
|
context['vysledkovka'] = VysledkovkaDoTeXu( |
|
|
|
|
|
cislo, |
|
|
|
|
|
od_vyjma=cislopred.zlomovy_deadline_pro_papirove_cislo(), |
|
|
|
|
|
do_vcetne=cislo.zlomovy_deadline_pro_papirove_cislo(), |
|
|
|
|
|
) |
|
|
|
|
|
else: |
|
|
|
|
|
context['vysledkovka'] = VysledkovkaCisla( |
|
|
|
|
|
cislo, |
|
|
|
|
|
jen_verejne=False, |
|
|
|
|
|
do_deadlinu=cislo.zlomovy_deadline_pro_papirove_cislo(), |
|
|
|
|
|
) |
|
|
|
|
|
return context |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Podle předchozího |
|
|
|
|
|
class PosledniCisloVysledkovkaView(generic.DetailView): |
|
|
|
|
|
"""View vytvořené pro zobrazení výsledkovky posledního čísla v TeXu.""" |
|
|
|
|
|
|
|
|
|
|
|
model = Rocnik |
|
|
|
|
|
template_name = 'seminar/archiv/cislo_vysledkovka.tex' |
|
|
|
|
|
content_type = 'text/plain; charset=UTF8' |
|
|
|
|
|
|
|
|
|
|
|
def get_object(self, queryset=None): |
|
|
|
|
|
if queryset is None: |
|
|
|
|
|
queryset = self.get_queryset() |
|
|
|
|
|
rocnik_arg = self.kwargs.get('rocnik') |
|
|
|
|
|
queryset = queryset.filter(rocnik=rocnik_arg) |
|
|
|
|
|
|
|
|
|
|
|
try: |
|
|
|
|
|
obj = queryset.get() |
|
|
|
|
|
except queryset.model.DoesNotExist: |
|
|
|
|
|
raise Http404(_("No %(verbose_name)s found matching the query") % |
|
|
|
|
|
{'verbose_name': queryset.model._meta.verbose_name}) |
|
|
|
|
|
return obj |
|
|
|
|
|
|
|
|
|
|
|
def get_context_data(self, **kwargs): |
|
|
|
|
|
context = super(PosledniCisloVysledkovkaView, self).get_context_data() |
|
|
|
|
|
rocnik = context['rocnik'] |
|
|
|
|
|
cislo = rocnik.cisla.order_by("poradi").last() |
|
|
|
|
|
cislopred = cislo.predchozi() |
|
|
|
|
|
context['vysledkovka'] = VysledkovkaDoTeXu( |
|
|
|
|
|
cislo, |
|
|
|
|
|
od_vyjma=cislopred.zlomovy_deadline_pro_papirove_cislo(), |
|
|
|
|
|
do_vcetne=cislo.deadline_v_cisle.order_by("deadline").last(), |
|
|
|
|
|
) |
|
|
|
|
|
return context |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class RocnikVysledkovkaView(RocnikView): |
|
|
class RocnikVysledkovkaView(RocnikView): |
|
|
""" View vytvořené pro stránku zobrazující výsledkovku ročníku v TeXu.""" |
|
|
""" View vytvořené pro stránku zobrazující výsledkovku ročníku v TeXu.""" |
|
|
model = Rocnik |
|
|
model = Rocnik |
|
|