|
@ -1192,6 +1192,10 @@ class RocnikNode(TreeNode): |
|
|
on_delete = models.PROTECT, # Pokud chci mazat ročník, musím si Node pořešit ručně |
|
|
on_delete = models.PROTECT, # Pokud chci mazat ročník, musím si Node pořešit ručně |
|
|
verbose_name = "ročník") |
|
|
verbose_name = "ročník") |
|
|
|
|
|
|
|
|
|
|
|
def aktualizuj_nazev(self): |
|
|
|
|
|
self.nazev = "RocnikNode: "+str(self.rocnik) |
|
|
|
|
|
self.save() |
|
|
|
|
|
|
|
|
class CisloNode(TreeNode): |
|
|
class CisloNode(TreeNode): |
|
|
class Meta: |
|
|
class Meta: |
|
|
db_table = 'seminar_nodes_cislo' |
|
|
db_table = 'seminar_nodes_cislo' |
|
@ -1201,12 +1205,33 @@ class CisloNode(TreeNode): |
|
|
on_delete = models.PROTECT, # Pokud chci mazat číslo, musím si Node pořešit ručně |
|
|
on_delete = models.PROTECT, # Pokud chci mazat číslo, musím si Node pořešit ručně |
|
|
verbose_name = "číslo") |
|
|
verbose_name = "číslo") |
|
|
|
|
|
|
|
|
|
|
|
def aktualizuj_nazev(self): |
|
|
|
|
|
self.nazev = "CisloNode: "+str(self.cislo) |
|
|
|
|
|
self.save() |
|
|
|
|
|
|
|
|
class MezicisloNode(TreeNode): |
|
|
class MezicisloNode(TreeNode): |
|
|
class Meta: |
|
|
class Meta: |
|
|
db_table = 'seminar_nodes_mezicislo' |
|
|
db_table = 'seminar_nodes_mezicislo' |
|
|
verbose_name = 'Mezičíslo (Node)' |
|
|
verbose_name = 'Mezičíslo (Node)' |
|
|
verbose_name_plural = 'Mezičísla (Node)' |
|
|
verbose_name_plural = 'Mezičísla (Node)' |
|
|
|
|
|
|
|
|
|
|
|
def aktualizuj_nazev(self): |
|
|
|
|
|
if self.prev: |
|
|
|
|
|
if (self.prev.get_real_instance_class() != CisloNode and |
|
|
|
|
|
self.prev.get_real_instance_class() != MezicisloNode): |
|
|
|
|
|
raise ValueError("Předchůdce není číslo!") |
|
|
|
|
|
posledni = self.prev.cislo |
|
|
|
|
|
self.nazev = "MezicisloNode: Mezičíslo po čísle"+str(posledni) |
|
|
|
|
|
elif self.root: |
|
|
|
|
|
if self.root.get_real_instance_class() != RocnikNode: |
|
|
|
|
|
raise ValueError("Kořen stromu není ročník!") |
|
|
|
|
|
rocnik = self.root.rocnik |
|
|
|
|
|
self.nazev = "MezicisloNode: První mezičíslo ročníku "+str(rocnik) |
|
|
|
|
|
else: |
|
|
|
|
|
print("!!!!! Nějaké neidentifikované 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 """ |
|
|
class Meta: |
|
|
class Meta: |
|
@ -1217,6 +1242,10 @@ class TemaVCisleNode(TreeNode): |
|
|
on_delete=models.PROTECT, # Pokud chci mazat téma, musím si Node pořešit ručně |
|
|
on_delete=models.PROTECT, # Pokud chci mazat téma, musím si Node pořešit ručně |
|
|
verbose_name = "téma v čísle") |
|
|
verbose_name = "téma v čísle") |
|
|
|
|
|
|
|
|
|
|
|
def aktualizuj_nazev(self): |
|
|
|
|
|
self.nazev = "TemaVCisleNode: "+str(self.tema) |
|
|
|
|
|
self.save() |
|
|
|
|
|
|
|
|
class KonferaNode(TreeNode): |
|
|
class KonferaNode(TreeNode): |
|
|
class Meta: |
|
|
class Meta: |
|
|
db_table = 'seminar_nodes_konfera' |
|
|
db_table = 'seminar_nodes_konfera' |
|
@ -1228,6 +1257,10 @@ class KonferaNode(TreeNode): |
|
|
null=True, |
|
|
null=True, |
|
|
blank=False) |
|
|
blank=False) |
|
|
|
|
|
|
|
|
|
|
|
def aktualizuj_nazev(self): |
|
|
|
|
|
self.nazev = "KonferaNode: "+str(self.konfera) |
|
|
|
|
|
self.save() |
|
|
|
|
|
|
|
|
class ClanekNode(TreeNode): |
|
|
class ClanekNode(TreeNode): |
|
|
class Meta: |
|
|
class Meta: |
|
|
db_table = 'seminar_nodes_clanek' |
|
|
db_table = 'seminar_nodes_clanek' |
|
@ -1239,6 +1272,10 @@ class ClanekNode(TreeNode): |
|
|
null=True, |
|
|
null=True, |
|
|
blank=False) |
|
|
blank=False) |
|
|
|
|
|
|
|
|
|
|
|
def aktualizuj_nazev(self): |
|
|
|
|
|
self.nazev = "ClanekNode: "+str(self.clanek) |
|
|
|
|
|
self.save() |
|
|
|
|
|
|
|
|
class UlohaZadaniNode(TreeNode): |
|
|
class UlohaZadaniNode(TreeNode): |
|
|
class Meta: |
|
|
class Meta: |
|
|
db_table = 'seminar_nodes_uloha_zadani' |
|
|
db_table = 'seminar_nodes_uloha_zadani' |
|
@ -1250,6 +1287,10 @@ class UlohaZadaniNode(TreeNode): |
|
|
null=True, |
|
|
null=True, |
|
|
blank=False) |
|
|
blank=False) |
|
|
|
|
|
|
|
|
|
|
|
def aktualizuj_nazev(self): |
|
|
|
|
|
self.nazev = "UlohaZadaniNode: "+str(self.uloha) |
|
|
|
|
|
self.save() |
|
|
|
|
|
|
|
|
class PohadkaNode(TreeNode): |
|
|
class PohadkaNode(TreeNode): |
|
|
class Meta: |
|
|
class Meta: |
|
|
db_table = 'seminar_nodes_pohadka' |
|
|
db_table = 'seminar_nodes_pohadka' |
|
@ -1260,6 +1301,10 @@ class PohadkaNode(TreeNode): |
|
|
verbose_name = "pohádka", |
|
|
verbose_name = "pohádka", |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
def aktualizuj_nazev(self): |
|
|
|
|
|
self.nazev = "PohadkaNode: "+str(self.pohadka) |
|
|
|
|
|
self.save() |
|
|
|
|
|
|
|
|
class UlohaVzorakNode(TreeNode): |
|
|
class UlohaVzorakNode(TreeNode): |
|
|
class Meta: |
|
|
class Meta: |
|
|
db_table = 'seminar_nodes_uloha_vzorak' |
|
|
db_table = 'seminar_nodes_uloha_vzorak' |
|
@ -1271,6 +1316,10 @@ class UlohaVzorakNode(TreeNode): |
|
|
null=True, |
|
|
null=True, |
|
|
blank=False) |
|
|
blank=False) |
|
|
|
|
|
|
|
|
|
|
|
def aktualizuj_nazev(self): |
|
|
|
|
|
self.nazev = "UlohaVzorakNode: "+str(self.uloha) |
|
|
|
|
|
self.save() |
|
|
|
|
|
|
|
|
class TextNode(TreeNode): |
|
|
class TextNode(TreeNode): |
|
|
class Meta: |
|
|
class Meta: |
|
|
db_table = 'seminar_nodes_obsah' |
|
|
db_table = 'seminar_nodes_obsah' |
|
@ -1280,6 +1329,10 @@ class TextNode(TreeNode): |
|
|
on_delete=models.PROTECT, |
|
|
on_delete=models.PROTECT, |
|
|
verbose_name = 'text') |
|
|
verbose_name = 'text') |
|
|
|
|
|
|
|
|
|
|
|
def aktualizuj_nazev(self): |
|
|
|
|
|
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): |
|
|
# |
|
|
# |
|
|