|
|
@ -1147,6 +1147,7 @@ class TreeNode(PolymorphicModel): |
|
|
|
verbose_name = "TreeNode" |
|
|
|
verbose_name_plural = "TreeNody" |
|
|
|
|
|
|
|
# TODO: Nechceme radši jako root vyžadovat přímo RocnikNode? |
|
|
|
root = models.ForeignKey('TreeNode', |
|
|
|
related_name="potomci_set", |
|
|
|
null = True, |
|
|
@ -1176,7 +1177,11 @@ class TreeNode(PolymorphicModel): |
|
|
|
self.succ.print_tree(indent=indent) |
|
|
|
|
|
|
|
def __str__(self): |
|
|
|
if self.nazev: |
|
|
|
return self.nazev |
|
|
|
else: |
|
|
|
#TODO: logování |
|
|
|
return "Nepojmenovaný Treenode" |
|
|
|
|
|
|
|
class RocnikNode(TreeNode): |
|
|
|
class Meta: |
|
|
@ -1186,8 +1191,6 @@ class RocnikNode(TreeNode): |
|
|
|
rocnik = models.OneToOneField(Rocnik, |
|
|
|
on_delete = models.PROTECT, # Pokud chci mazat ročník, musím si Node pořešit ručně |
|
|
|
verbose_name = "ročník") |
|
|
|
def __str__(self): |
|
|
|
return 'RocnikNode: '+str(self.rocnik) |
|
|
|
|
|
|
|
class CisloNode(TreeNode): |
|
|
|
class Meta: |
|
|
@ -1197,16 +1200,12 @@ class CisloNode(TreeNode): |
|
|
|
cislo = models.OneToOneField(Cislo, |
|
|
|
on_delete = models.PROTECT, # Pokud chci mazat číslo, musím si Node pořešit ručně |
|
|
|
verbose_name = "číslo") |
|
|
|
def __str__(self): |
|
|
|
return 'CisloNode: '+str(self.cislo) |
|
|
|
|
|
|
|
class MezicisloNode(TreeNode): |
|
|
|
class Meta: |
|
|
|
db_table = 'seminar_nodes_mezicislo' |
|
|
|
verbose_name = 'Mezičíslo (Node)' |
|
|
|
verbose_name_plural = 'Mezičísla (Node)' |
|
|
|
def __str__(self): |
|
|
|
return 'MezicisloNode' |
|
|
|
|
|
|
|
class TemaVCisleNode(TreeNode): |
|
|
|
""" Obsahuje příspěvky k tématu v daném čísle """ |
|
|
@ -1217,8 +1216,6 @@ class TemaVCisleNode(TreeNode): |
|
|
|
tema = models.ForeignKey(Tema, |
|
|
|
on_delete=models.PROTECT, # Pokud chci mazat téma, musím si Node pořešit ručně |
|
|
|
verbose_name = "téma v čísle") |
|
|
|
def __str__(self): |
|
|
|
return 'TemaVCisleNode: tema: '+str(self.tema) |
|
|
|
|
|
|
|
class KonferaNode(TreeNode): |
|
|
|
class Meta: |
|
|
@ -1230,8 +1227,6 @@ class KonferaNode(TreeNode): |
|
|
|
verbose_name = "konfera", |
|
|
|
null=True, |
|
|
|
blank=False) |
|
|
|
def __str__(self): |
|
|
|
return 'KonferaNode: '+str(self.konfera) |
|
|
|
|
|
|
|
class ClanekNode(TreeNode): |
|
|
|
class Meta: |
|
|
@ -1243,8 +1238,6 @@ class ClanekNode(TreeNode): |
|
|
|
verbose_name = "článek", |
|
|
|
null=True, |
|
|
|
blank=False) |
|
|
|
def __str__(self): |
|
|
|
return 'ClanekNode: '+str(self.clanek) |
|
|
|
|
|
|
|
class UlohaZadaniNode(TreeNode): |
|
|
|
class Meta: |
|
|
@ -1256,8 +1249,6 @@ class UlohaZadaniNode(TreeNode): |
|
|
|
verbose_name = "úloha", |
|
|
|
null=True, |
|
|
|
blank=False) |
|
|
|
def __str__(self): |
|
|
|
return 'UlohaZadaniNode: '+str(self.uloha) |
|
|
|
|
|
|
|
class PohadkaNode(TreeNode): |
|
|
|
class Meta: |
|
|
@ -1268,8 +1259,6 @@ class PohadkaNode(TreeNode): |
|
|
|
on_delete=models.PROTECT, # Pokud chci mazat pohádku, musím si Node pořešit ručně |
|
|
|
verbose_name = "pohádka", |
|
|
|
) |
|
|
|
def __str__(self): |
|
|
|
return 'PohadkaNode: '+str(self.pohadka) |
|
|
|
|
|
|
|
class UlohaVzorakNode(TreeNode): |
|
|
|
class Meta: |
|
|
@ -1281,8 +1270,6 @@ class UlohaVzorakNode(TreeNode): |
|
|
|
verbose_name = "úloha", |
|
|
|
null=True, |
|
|
|
blank=False) |
|
|
|
def __str__(self): |
|
|
|
return 'UlohaVzorakNode: '+str(self.uloha) |
|
|
|
|
|
|
|
class TextNode(TreeNode): |
|
|
|
class Meta: |
|
|
@ -1292,8 +1279,6 @@ class TextNode(TreeNode): |
|
|
|
text = models.ForeignKey(Text, |
|
|
|
on_delete=models.PROTECT, |
|
|
|
verbose_name = 'text') |
|
|
|
def __str__(self): |
|
|
|
return 'TextNode: '+str(self.text) |
|
|
|
|
|
|
|
## FIXME: Logiku přesunout do views. |
|
|
|
#class VysledkyBase(SeminarModelBase): |
|
|
|