|
@ -26,6 +26,7 @@ from taggit.managers import TaggableManager |
|
|
from reversion import revisions as reversion |
|
|
from reversion import revisions as reversion |
|
|
|
|
|
|
|
|
from seminar.utils import roman, FirstTagParser # Pro získání úryvku z TextNode |
|
|
from seminar.utils import roman, FirstTagParser # Pro získání úryvku z TextNode |
|
|
|
|
|
from seminar import treelib |
|
|
|
|
|
|
|
|
from unidecode import unidecode # Používám pro získání ID odkazu (ještě je to někde po někom zakomentované) |
|
|
from unidecode import unidecode # Používám pro získání ID odkazu (ještě je to někde po někom zakomentované) |
|
|
|
|
|
|
|
@ -869,13 +870,22 @@ class Problem(SeminarModelBase,PolymorphicModel): |
|
|
stav_verejny = False |
|
|
stav_verejny = False |
|
|
if self.stav == 'zadany' or self.stav == 'vyreseny': |
|
|
if self.stav == 'zadany' or self.stav == 'vyreseny': |
|
|
stav_verejny = True |
|
|
stav_verejny = True |
|
|
return stav_verejny |
|
|
print("stav_verejny: {}".format(stav_verejny)) |
|
|
|
|
|
|
|
|
#cislo_verejne = False |
|
|
cislo_verejne = False |
|
|
#if (self.cislo_zadani and self.cislo_zadani.verejne()): |
|
|
cislonode = self.cislo_node() |
|
|
# cislo_verejne = True |
|
|
if cislonode is None: |
|
|
|
|
|
# problém nemá vlastní node, veřejnost posuzujeme jen podle stavu |
|
|
#return (stav_verejny and cislo_verejne) |
|
|
print("empty node") |
|
|
|
|
|
return stav_verejny |
|
|
|
|
|
else: |
|
|
|
|
|
cislo_zadani = cislonode.cislo |
|
|
|
|
|
if (cislo_zadani and cislo_zadani.verejne()): |
|
|
|
|
|
print("cislo: {}".format(cislo_zadani)) |
|
|
|
|
|
cislo_verejne = True |
|
|
|
|
|
print("stav_verejny: {}".format(stav_verejny)) |
|
|
|
|
|
print("cislo_verejne: {}".format(cislo_verejne)) |
|
|
|
|
|
return (stav_verejny and cislo_verejne) |
|
|
verejne.boolean = True |
|
|
verejne.boolean = True |
|
|
|
|
|
|
|
|
def verejne_url(self): |
|
|
def verejne_url(self): |
|
@ -930,6 +940,16 @@ class Tema(Problem): |
|
|
for tvcn in self.temavcislenode_set.all(): |
|
|
for tvcn in self.temavcislenode_set.all(): |
|
|
tvcn.save() |
|
|
tvcn.save() |
|
|
|
|
|
|
|
|
|
|
|
def cislo_node(self): |
|
|
|
|
|
tema_node_set = self.temavcislenode_set.all() |
|
|
|
|
|
tema_cisla_vyskyt = [] |
|
|
|
|
|
for tn in tema_node_set: |
|
|
|
|
|
tema_cisla_vyskyt.append( |
|
|
|
|
|
treelib.get_upper_node_of_type(tn, CisloNode).cislo) |
|
|
|
|
|
tema_cisla_vyskyt.sort(key=lambda x:x.datum_vydani) |
|
|
|
|
|
prvni_zadani = tema_cisla_vyskyt[0] |
|
|
|
|
|
return prvni_zadani.cislonode |
|
|
|
|
|
|
|
|
class Clanek(Problem): |
|
|
class Clanek(Problem): |
|
|
class Meta: |
|
|
class Meta: |
|
|
db_table = 'seminar_clanky' |
|
|
db_table = 'seminar_clanky' |
|
@ -946,6 +966,9 @@ class Clanek(Problem): |
|
|
# return self.nadproblem.kod_v_rocniku()+".c{}".format(self.kod) |
|
|
# return self.nadproblem.kod_v_rocniku()+".c{}".format(self.kod) |
|
|
return "c{}".format(self.kod) |
|
|
return "c{}".format(self.kod) |
|
|
return '<Není zadaný>' |
|
|
return '<Není zadaný>' |
|
|
|
|
|
|
|
|
|
|
|
def node(self): |
|
|
|
|
|
return None |
|
|
|
|
|
|
|
|
class Text(SeminarModelBase): |
|
|
class Text(SeminarModelBase): |
|
|
class Meta: |
|
|
class Meta: |
|
@ -1019,6 +1042,9 @@ class Uloha(Problem): |
|
|
# Neexistující *Node nemá smysl aktualizovat. |
|
|
# Neexistující *Node nemá smysl aktualizovat. |
|
|
pass |
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
def cislo_node(self): |
|
|
|
|
|
zadani_node = self.ulohazadaninode |
|
|
|
|
|
return treelib.get_upper_node_of_type(zadani_node, CisloNode) |
|
|
|
|
|
|
|
|
@reversion.register(ignore_duplicates=True) |
|
|
@reversion.register(ignore_duplicates=True) |
|
|
class Reseni(SeminarModelBase): |
|
|
class Reseni(SeminarModelBase): |
|
@ -1309,6 +1335,8 @@ class Konfera(Problem): |
|
|
def __str__(self): |
|
|
def __str__(self): |
|
|
return "{}: ({})".format(self.nazev, self.soustredeni) |
|
|
return "{}: ({})".format(self.nazev, self.soustredeni) |
|
|
|
|
|
|
|
|
|
|
|
def cislo_node(self): |
|
|
|
|
|
return None |
|
|
|
|
|
|
|
|
# Vazebna tabulka. Mozna se generuje automaticky. |
|
|
# Vazebna tabulka. Mozna se generuje automaticky. |
|
|
@reversion.register(ignore_duplicates=True) |
|
|
@reversion.register(ignore_duplicates=True) |
|
|