|
@ -384,6 +384,10 @@ class Rocnik(SeminarModelBase): |
|
|
cache.set(name, c, 300) |
|
|
cache.set(name, c, 300) |
|
|
return c |
|
|
return c |
|
|
|
|
|
|
|
|
|
|
|
def save(self): |
|
|
|
|
|
super().save() |
|
|
|
|
|
# *Node.save() aktualizuje název *Nodu. |
|
|
|
|
|
self.rocniknode.save() |
|
|
|
|
|
|
|
|
def cislo_pdf_filename(self, filename): |
|
|
def cislo_pdf_filename(self, filename): |
|
|
rocnik = str(self.rocnik.rocnik) |
|
|
rocnik = str(self.rocnik.rocnik) |
|
@ -477,6 +481,11 @@ class Cislo(SeminarModelBase): |
|
|
return None |
|
|
return None |
|
|
return c |
|
|
return c |
|
|
|
|
|
|
|
|
|
|
|
def save(self): |
|
|
|
|
|
super().save() |
|
|
|
|
|
# *Node.save() aktualizuje název *Nodu. |
|
|
|
|
|
self.cislonode.save() |
|
|
|
|
|
|
|
|
@reversion.register(ignore_duplicates=True) |
|
|
@reversion.register(ignore_duplicates=True) |
|
|
class Organizator(SeminarModelBase): |
|
|
class Organizator(SeminarModelBase): |
|
|
# zmena dedicnosti z models.Model na SeminarModelBase, potencialni vznik bugu |
|
|
# zmena dedicnosti z models.Model na SeminarModelBase, potencialni vznik bugu |
|
@ -707,6 +716,12 @@ class Tema(Problem): |
|
|
return "t{}".format(self.kod) |
|
|
return "t{}".format(self.kod) |
|
|
return '<Není zadaný>' |
|
|
return '<Není zadaný>' |
|
|
|
|
|
|
|
|
|
|
|
def save(self): |
|
|
|
|
|
super().save() |
|
|
|
|
|
# *Node.save() aktualizuje název *Nodu. |
|
|
|
|
|
for tvcn in self_temavcislenode_set: |
|
|
|
|
|
tvcn.save() |
|
|
|
|
|
|
|
|
class Clanek(Problem): |
|
|
class Clanek(Problem): |
|
|
class Meta: |
|
|
class Meta: |
|
|
db_table = 'seminar_clanky' |
|
|
db_table = 'seminar_clanky' |
|
@ -727,6 +742,11 @@ class Clanek(Problem): |
|
|
return "c{}".format(self.kod) |
|
|
return "c{}".format(self.kod) |
|
|
return '<Není zadaný>' |
|
|
return '<Není zadaný>' |
|
|
|
|
|
|
|
|
|
|
|
def save(self): |
|
|
|
|
|
super().save() |
|
|
|
|
|
# *Node.save() aktualizuje název *Nodu. |
|
|
|
|
|
self.claneknode.save() |
|
|
|
|
|
|
|
|
class Text(SeminarModelBase): |
|
|
class Text(SeminarModelBase): |
|
|
class Meta: |
|
|
class Meta: |
|
|
db_table = 'seminar_texty' |
|
|
db_table = 'seminar_texty' |
|
@ -744,6 +764,12 @@ class Text(SeminarModelBase): |
|
|
|
|
|
|
|
|
# obrázky mají návaznost opačným směrem (vazba z druhé strany) |
|
|
# obrázky mají návaznost opačným směrem (vazba z druhé strany) |
|
|
|
|
|
|
|
|
|
|
|
def save(self): |
|
|
|
|
|
super().save() |
|
|
|
|
|
# *Node.save() aktualizuje název *Nodu. |
|
|
|
|
|
for tn in self.textnode_set: |
|
|
|
|
|
tn.save() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Uloha(Problem): |
|
|
class Uloha(Problem): |
|
@ -778,6 +804,12 @@ class Uloha(Problem): |
|
|
return name |
|
|
return name |
|
|
return '<Není zadaný>' |
|
|
return '<Není zadaný>' |
|
|
|
|
|
|
|
|
|
|
|
def save(self): |
|
|
|
|
|
super().save() |
|
|
|
|
|
# *Node.save() aktualizuje název *Nodu. |
|
|
|
|
|
self.ulohazadaninode.save() |
|
|
|
|
|
self.ulohavzoraknode.save() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@reversion.register(ignore_duplicates=True) |
|
|
@reversion.register(ignore_duplicates=True) |
|
|
class Reseni(SeminarModelBase): |
|
|
class Reseni(SeminarModelBase): |
|
@ -959,6 +991,10 @@ class Pohadka(SeminarModelBase): |
|
|
uryvek = self.text if len(self.text) < 50 else self.text[:(50-3)]+"..." |
|
|
uryvek = self.text if len(self.text) < 50 else self.text[:(50-3)]+"..." |
|
|
return uryvek |
|
|
return uryvek |
|
|
|
|
|
|
|
|
|
|
|
def save(self): |
|
|
|
|
|
super().save() |
|
|
|
|
|
# *Node.save() aktualizuje název *Nodu. |
|
|
|
|
|
self.pohadkanode.save() |
|
|
|
|
|
|
|
|
@reversion.register(ignore_duplicates=True) |
|
|
@reversion.register(ignore_duplicates=True) |
|
|
class Soustredeni_Ucastnici(SeminarModelBase): |
|
|
class Soustredeni_Ucastnici(SeminarModelBase): |
|
@ -1069,6 +1105,11 @@ class Konfera(models.Model): |
|
|
def __str__(self): |
|
|
def __str__(self): |
|
|
return "{}: ({})".format(self.nazev, self.soustredeni) |
|
|
return "{}: ({})".format(self.nazev, self.soustredeni) |
|
|
|
|
|
|
|
|
|
|
|
def save(self): |
|
|
|
|
|
super().save() |
|
|
|
|
|
# *Node.save() aktualizuje název *Nodu. |
|
|
|
|
|
self.konferanode.save() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Vazebna tabulka. Mozna se generuje automaticky. |
|
|
# Vazebna tabulka. Mozna se generuje automaticky. |
|
|
@reversion.register(ignore_duplicates=True) |
|
|
@reversion.register(ignore_duplicates=True) |
|
@ -1182,6 +1223,10 @@ class TreeNode(PolymorphicModel): |
|
|
else: |
|
|
else: |
|
|
#TODO: logování |
|
|
#TODO: logování |
|
|
return "Nepojmenovaný Treenode" |
|
|
return "Nepojmenovaný Treenode" |
|
|
|
|
|
|
|
|
|
|
|
def save(self): |
|
|
|
|
|
self.aktualizuj_nazev() |
|
|
|
|
|
super().save() |
|
|
|
|
|
|
|
|
class RocnikNode(TreeNode): |
|
|
class RocnikNode(TreeNode): |
|
|
class Meta: |
|
|
class Meta: |
|
@ -1194,7 +1239,6 @@ class RocnikNode(TreeNode): |
|
|
|
|
|
|
|
|
def aktualizuj_nazev(self): |
|
|
def aktualizuj_nazev(self): |
|
|
self.nazev = "RocnikNode: "+str(self.rocnik) |
|
|
self.nazev = "RocnikNode: "+str(self.rocnik) |
|
|
self.save() |
|
|
|
|
|
|
|
|
|
|
|
class CisloNode(TreeNode): |
|
|
class CisloNode(TreeNode): |
|
|
class Meta: |
|
|
class Meta: |
|
@ -1207,7 +1251,6 @@ class CisloNode(TreeNode): |
|
|
|
|
|
|
|
|
def aktualizuj_nazev(self): |
|
|
def aktualizuj_nazev(self): |
|
|
self.nazev = "CisloNode: "+str(self.cislo) |
|
|
self.nazev = "CisloNode: "+str(self.cislo) |
|
|
self.save() |
|
|
|
|
|
|
|
|
|
|
|
class MezicisloNode(TreeNode): |
|
|
class MezicisloNode(TreeNode): |
|
|
class Meta: |
|
|
class Meta: |
|
@ -1230,7 +1273,6 @@ class MezicisloNode(TreeNode): |
|
|
else: |
|
|
else: |
|
|
print("!!!!! Nějaké neidentifikované mezičíslo !!!!!") |
|
|
print("!!!!! Nějaké neidentifikované mezičíslo !!!!!") |
|
|
self.nazev = "MezicisloNode: Neidentifikovatelné mezičíslo!" |
|
|
self.nazev = "MezicisloNode: Neidentifikovatelné mezičíslo!" |
|
|
self.save() |
|
|
|
|
|
|
|
|
|
|
|
class TemaVCisleNode(TreeNode): |
|
|
class TemaVCisleNode(TreeNode): |
|
|
""" Obsahuje příspěvky k tématu v daném čísle """ |
|
|
""" Obsahuje příspěvky k tématu v daném čísle """ |
|
@ -1244,7 +1286,6 @@ class TemaVCisleNode(TreeNode): |
|
|
|
|
|
|
|
|
def aktualizuj_nazev(self): |
|
|
def aktualizuj_nazev(self): |
|
|
self.nazev = "TemaVCisleNode: "+str(self.tema) |
|
|
self.nazev = "TemaVCisleNode: "+str(self.tema) |
|
|
self.save() |
|
|
|
|
|
|
|
|
|
|
|
class KonferaNode(TreeNode): |
|
|
class KonferaNode(TreeNode): |
|
|
class Meta: |
|
|
class Meta: |
|
@ -1259,7 +1300,6 @@ class KonferaNode(TreeNode): |
|
|
|
|
|
|
|
|
def aktualizuj_nazev(self): |
|
|
def aktualizuj_nazev(self): |
|
|
self.nazev = "KonferaNode: "+str(self.konfera) |
|
|
self.nazev = "KonferaNode: "+str(self.konfera) |
|
|
self.save() |
|
|
|
|
|
|
|
|
|
|
|
class ClanekNode(TreeNode): |
|
|
class ClanekNode(TreeNode): |
|
|
class Meta: |
|
|
class Meta: |
|
@ -1274,7 +1314,6 @@ class ClanekNode(TreeNode): |
|
|
|
|
|
|
|
|
def aktualizuj_nazev(self): |
|
|
def aktualizuj_nazev(self): |
|
|
self.nazev = "ClanekNode: "+str(self.clanek) |
|
|
self.nazev = "ClanekNode: "+str(self.clanek) |
|
|
self.save() |
|
|
|
|
|
|
|
|
|
|
|
class UlohaZadaniNode(TreeNode): |
|
|
class UlohaZadaniNode(TreeNode): |
|
|
class Meta: |
|
|
class Meta: |
|
@ -1289,7 +1328,6 @@ class UlohaZadaniNode(TreeNode): |
|
|
|
|
|
|
|
|
def aktualizuj_nazev(self): |
|
|
def aktualizuj_nazev(self): |
|
|
self.nazev = "UlohaZadaniNode: "+str(self.uloha) |
|
|
self.nazev = "UlohaZadaniNode: "+str(self.uloha) |
|
|
self.save() |
|
|
|
|
|
|
|
|
|
|
|
class PohadkaNode(TreeNode): |
|
|
class PohadkaNode(TreeNode): |
|
|
class Meta: |
|
|
class Meta: |
|
@ -1303,7 +1341,6 @@ class PohadkaNode(TreeNode): |
|
|
|
|
|
|
|
|
def aktualizuj_nazev(self): |
|
|
def aktualizuj_nazev(self): |
|
|
self.nazev = "PohadkaNode: "+str(self.pohadka) |
|
|
self.nazev = "PohadkaNode: "+str(self.pohadka) |
|
|
self.save() |
|
|
|
|
|
|
|
|
|
|
|
class UlohaVzorakNode(TreeNode): |
|
|
class UlohaVzorakNode(TreeNode): |
|
|
class Meta: |
|
|
class Meta: |
|
@ -1318,7 +1355,6 @@ class UlohaVzorakNode(TreeNode): |
|
|
|
|
|
|
|
|
def aktualizuj_nazev(self): |
|
|
def aktualizuj_nazev(self): |
|
|
self.nazev = "UlohaVzorakNode: "+str(self.uloha) |
|
|
self.nazev = "UlohaVzorakNode: "+str(self.uloha) |
|
|
self.save() |
|
|
|
|
|
|
|
|
|
|
|
class TextNode(TreeNode): |
|
|
class TextNode(TreeNode): |
|
|
class Meta: |
|
|
class Meta: |
|
@ -1331,7 +1367,6 @@ class TextNode(TreeNode): |
|
|
|
|
|
|
|
|
def aktualizuj_nazev(self): |
|
|
def aktualizuj_nazev(self): |
|
|
self.nazev = "TextNode: "+str(self.text) |
|
|
self.nazev = "TextNode: "+str(self.text) |
|
|
self.save() |
|
|
|
|
|
|
|
|
|
|
|
## FIXME: Logiku přesunout do views. |
|
|
## FIXME: Logiku přesunout do views. |
|
|
#class VysledkyBase(SeminarModelBase): |
|
|
#class VysledkyBase(SeminarModelBase): |
|
|