|
@ -1012,19 +1012,21 @@ def group_by_rocnik(clanky): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# FIXME: clanky jsou vsechny, pokud budou i neresitelske, tak se take zobrazi |
|
|
# FIXME: clanky jsou vsechny, pokud budou i neresitelske, tak se take zobrazi |
|
|
|
|
|
# FIXME: Původně tu byl kód přímo v těle třídy, což rozbíjelo migrace. Opravil jsem, ale vůbec nevím, jestli to funguje. |
|
|
class ClankyResitelView(generic.ListView): |
|
|
class ClankyResitelView(generic.ListView): |
|
|
model = Problem |
|
|
model = Problem |
|
|
template_name = 'seminar/clanky/resitelske_clanky.html' |
|
|
template_name = 'seminar/clanky/resitelske_clanky.html' |
|
|
#queryset |
|
|
|
|
|
clanky = Clanek.objects.filter(stav=Problem.STAV_ZADANY).select_related('cislo__rocnik').order_by('-cislo__rocnik__rocnik') |
|
|
|
|
|
queryset = [] |
|
|
|
|
|
skupiny_clanku = group_by_rocnik(clanky) |
|
|
|
|
|
for skupina in skupiny_clanku: |
|
|
|
|
|
skupina.sort(key=lambda clanek: clanek.kod_v_rocniku()) |
|
|
|
|
|
for clanek in skupina: |
|
|
|
|
|
queryset.append(clanek) |
|
|
|
|
|
|
|
|
|
|
|
#zadani__rocnik').order_by('-cislo_zadani__rocnik__rocnik', 'kod') |
|
|
# FIXME: QuerySet není pole! |
|
|
|
|
|
def get_queryset(self): |
|
|
|
|
|
clanky = Clanek.objects.filter(stav=Problem.STAV_ZADANY).select_related('cislo__rocnik').order_by('-cislo__rocnik__rocnik') |
|
|
|
|
|
queryset = [] |
|
|
|
|
|
skupiny_clanku = group_by_rocnik(clanky) |
|
|
|
|
|
for skupina in skupiny_clanku: |
|
|
|
|
|
skupina.sort(key=lambda clanek: clanek.kod_v_rocniku()) |
|
|
|
|
|
for clanek in skupina: |
|
|
|
|
|
queryset.append(clanek) |
|
|
|
|
|
return queryset |
|
|
|
|
|
|
|
|
# FIXME: pokud chceme orgoclanky, tak nejak zavest do modelu a podle toho odkomentovat a upravit |
|
|
# FIXME: pokud chceme orgoclanky, tak nejak zavest do modelu a podle toho odkomentovat a upravit |
|
|
#class ClankyOrganizatorView(generic.ListView)<F12>: |
|
|
#class ClankyOrganizatorView(generic.ListView)<F12>: |
|
@ -1202,7 +1204,7 @@ def prihlaskaView(request): |
|
|
generic_logger.info("Form valid") |
|
|
generic_logger.info("Form valid") |
|
|
fcd = form.cleaned_data |
|
|
fcd = form.cleaned_data |
|
|
form_hash = hash(frozenset(fcd.items())) |
|
|
form_hash = hash(frozenset(fcd.items())) |
|
|
form_logger.info(fcd,form_hash) # TODO takhle log nefunguje, ale ta předchozí varianta dokonce padala |
|
|
form_logger.info(str(fcd) + str(form_hash)) # TODO možná logovat jinak |
|
|
|
|
|
|
|
|
with transaction.atomic(): |
|
|
with transaction.atomic(): |
|
|
u = User.objects.create_user( |
|
|
u = User.objects.create_user( |
|
@ -1232,7 +1234,7 @@ def prihlaskaView(request): |
|
|
else: |
|
|
else: |
|
|
# Unknown country - log it |
|
|
# Unknown country - log it |
|
|
msg = "Unknown country {}".format(fcd['stat_text']) |
|
|
msg = "Unknown country {}".format(fcd['stat_text']) |
|
|
err_logger.warn(msg,form_hash) # TODO viz výše |
|
|
err_logger.warn(msg + str(form_hash)) |
|
|
|
|
|
|
|
|
o.save() |
|
|
o.save() |
|
|
o.user = u |
|
|
o.user = u |
|
@ -1250,7 +1252,7 @@ def prihlaskaView(request): |
|
|
else: |
|
|
else: |
|
|
# Unknown school - log it |
|
|
# Unknown school - log it |
|
|
msg = "Unknown school {}, {}".format(fcd['skola_nazev'],fcd['skola_adresa']) |
|
|
msg = "Unknown school {}, {}".format(fcd['skola_nazev'],fcd['skola_adresa']) |
|
|
err_logger.warn(msg,form_hash) # TODO viz výše |
|
|
err_logger.warn(msg + str(form_hash)) |
|
|
r.save() |
|
|
r.save() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|