|
|
@ -26,6 +26,7 @@ from taggit.managers import TaggableManager |
|
|
|
from reversion import revisions as reversion |
|
|
|
|
|
|
|
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é) |
|
|
|
|
|
|
@ -869,13 +870,22 @@ class Problem(SeminarModelBase,PolymorphicModel): |
|
|
|
stav_verejny = False |
|
|
|
if self.stav == 'zadany' or self.stav == 'vyreseny': |
|
|
|
stav_verejny = True |
|
|
|
return stav_verejny |
|
|
|
|
|
|
|
#cislo_verejne = False |
|
|
|
#if (self.cislo_zadani and self.cislo_zadani.verejne()): |
|
|
|
# cislo_verejne = True |
|
|
|
print("stav_verejny: {}".format(stav_verejny)) |
|
|
|
|
|
|
|
#return (stav_verejny and cislo_verejne) |
|
|
|
cislo_verejne = False |
|
|
|
cislonode = self.cislo_node() |
|
|
|
if cislonode is None: |
|
|
|
# problém nemá vlastní node, veřejnost posuzujeme jen podle stavu |
|
|
|
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 |
|
|
|
|
|
|
|
def verejne_url(self): |
|
|
@ -930,6 +940,16 @@ class Tema(Problem): |
|
|
|
for tvcn in self.temavcislenode_set.all(): |
|
|
|
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 Meta: |
|
|
|
db_table = 'seminar_clanky' |
|
|
@ -947,6 +967,9 @@ class Clanek(Problem): |
|
|
|
return "c{}".format(self.kod) |
|
|
|
return '<Není zadaný>' |
|
|
|
|
|
|
|
def node(self): |
|
|
|
return None |
|
|
|
|
|
|
|
class Text(SeminarModelBase): |
|
|
|
class Meta: |
|
|
|
db_table = 'seminar_texty' |
|
|
@ -1019,6 +1042,9 @@ class Uloha(Problem): |
|
|
|
# Neexistující *Node nemá smysl aktualizovat. |
|
|
|
pass |
|
|
|
|
|
|
|
def cislo_node(self): |
|
|
|
zadani_node = self.ulohazadaninode |
|
|
|
return treelib.get_upper_node_of_type(zadani_node, CisloNode) |
|
|
|
|
|
|
|
@reversion.register(ignore_duplicates=True) |
|
|
|
class Reseni(SeminarModelBase): |
|
|
@ -1309,6 +1335,8 @@ class Konfera(Problem): |
|
|
|
def __str__(self): |
|
|
|
return "{}: ({})".format(self.nazev, self.soustredeni) |
|
|
|
|
|
|
|
def cislo_node(self): |
|
|
|
return None |
|
|
|
|
|
|
|
# Vazebna tabulka. Mozna se generuje automaticky. |
|
|
|
@reversion.register(ignore_duplicates=True) |
|
|
|