|
@ -2,6 +2,7 @@ from django import forms |
|
|
from dal import autocomplete |
|
|
from dal import autocomplete |
|
|
from django.forms import formset_factory |
|
|
from django.forms import formset_factory |
|
|
from django.forms.models import inlineformset_factory |
|
|
from django.forms.models import inlineformset_factory |
|
|
|
|
|
from django.utils import timezone |
|
|
|
|
|
|
|
|
from seminar.models import Resitel |
|
|
from seminar.models import Resitel |
|
|
import seminar.models as m |
|
|
import seminar.models as m |
|
@ -141,7 +142,6 @@ class OdevzdavatkoTabulkaFiltrForm(forms.Form): |
|
|
from django.db.utils import OperationalError |
|
|
from django.db.utils import OperationalError |
|
|
try: |
|
|
try: |
|
|
aktualni_rocnik = m.Nastaveni.get_solo().aktualni_rocnik |
|
|
aktualni_rocnik = m.Nastaveni.get_solo().aktualni_rocnik |
|
|
aktualni_cislo = m.Nastaveni.get_solo().aktualni_cislo |
|
|
|
|
|
except OperationalError: |
|
|
except OperationalError: |
|
|
# django.db.utils.OperationalError: no such table: seminar_nastaveni |
|
|
# django.db.utils.OperationalError: no such table: seminar_nastaveni |
|
|
# Nemáme databázi, takže to selhalo. Pro jistotu vrátíme aspoň dvě možnosti, ať to nepadá dál |
|
|
# Nemáme databázi, takže to selhalo. Pro jistotu vrátíme aspoň dvě možnosti, ať to nepadá dál |
|
@ -152,31 +152,18 @@ class OdevzdavatkoTabulkaFiltrForm(forms.Form): |
|
|
# FIXME: Tohle je hnusný monkey patch, mělo by to být nějak zahrnuto výš. |
|
|
# FIXME: Tohle je hnusný monkey patch, mělo by to být nějak zahrnuto výš. |
|
|
if rocnik is not None: |
|
|
if rocnik is not None: |
|
|
aktualni_rocnik = rocnik |
|
|
aktualni_rocnik = rocnik |
|
|
aktualni_cislo = m.Cislo.objects.filter(rocnik=rocnik).order_by('poradi').last() |
|
|
|
|
|
|
|
|
|
|
|
result = [] |
|
|
result = [] |
|
|
|
|
|
|
|
|
for cislo in m.Cislo.objects.filter( |
|
|
for deadline in m.Deadline.objects.filter( |
|
|
rocnik=aktualni_rocnik, |
|
|
deadline__lte=timezone.now(), |
|
|
poradi__lte=aktualni_cislo.poradi, |
|
|
cislo__rocnik=aktualni_rocnik |
|
|
).reverse(): # Standardně se řadí od nejnovějšího čísla |
|
|
).order_by("deadline").reverse(): |
|
|
# Předem je mi líto kohokoliv, kdo tyhle řádky bude číst... |
|
|
|
|
|
if cislo.datum_vydani is not None and cislo.datum_vydani <= datetime.date.today(): |
|
|
|
|
|
result.append(( |
|
|
|
|
|
strftime(DATE_FORMAT, cislo.datum_vydani.timetuple()), |
|
|
|
|
|
f"Vydání {cislo.poradi}. čísla")) |
|
|
|
|
|
if cislo.datum_preddeadline is not None and cislo.datum_preddeadline <= datetime.date.today(): |
|
|
|
|
|
result.append(( |
|
|
|
|
|
strftime(DATE_FORMAT, cislo.datum_preddeadline.timetuple()), |
|
|
|
|
|
f"Předdeadline {cislo.poradi}. čísla")) |
|
|
|
|
|
if cislo.datum_deadline_soustredeni is not None and cislo.datum_deadline_soustredeni <= datetime.date.today(): |
|
|
|
|
|
result.append(( |
|
|
|
|
|
strftime(DATE_FORMAT, cislo.datum_deadline_soustredeni.timetuple()), |
|
|
|
|
|
f"Sous. deadline {cislo.poradi}. čísla")) |
|
|
|
|
|
if cislo.datum_deadline is not None and cislo.datum_deadline <= datetime.date.today(): |
|
|
|
|
|
result.append(( |
|
|
result.append(( |
|
|
strftime(DATE_FORMAT, cislo.datum_deadline.timetuple()), |
|
|
strftime(DATE_FORMAT, deadline.deadline.timetuple()), |
|
|
f"Finální deadline {cislo.poradi}. čísla")) |
|
|
str(deadline))) |
|
|
|
|
|
|
|
|
result.append(( |
|
|
result.append(( |
|
|
strftime(DATE_FORMAT, datetime.date.today().timetuple()), f"Dnes")) |
|
|
strftime(DATE_FORMAT, datetime.date.today().timetuple()), f"Dnes")) |
|
|
|
|
|
|
|
|