Part1
This commit is contained in:
parent
43c1ae9c14
commit
281c66df11
1 changed files with 6 additions and 21 deletions
|
@ -1147,6 +1147,7 @@ class TreeNode(PolymorphicModel):
|
||||||
verbose_name = "TreeNode"
|
verbose_name = "TreeNode"
|
||||||
verbose_name_plural = "TreeNody"
|
verbose_name_plural = "TreeNody"
|
||||||
|
|
||||||
|
# TODO: Nechceme radši jako root vyžadovat přímo RocnikNode?
|
||||||
root = models.ForeignKey('TreeNode',
|
root = models.ForeignKey('TreeNode',
|
||||||
related_name="potomci_set",
|
related_name="potomci_set",
|
||||||
null = True,
|
null = True,
|
||||||
|
@ -1176,7 +1177,11 @@ class TreeNode(PolymorphicModel):
|
||||||
self.succ.print_tree(indent=indent)
|
self.succ.print_tree(indent=indent)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
if self.nazev:
|
||||||
return self.nazev
|
return self.nazev
|
||||||
|
else:
|
||||||
|
#TODO: logování
|
||||||
|
return "Nepojmenovaný Treenode"
|
||||||
|
|
||||||
class RocnikNode(TreeNode):
|
class RocnikNode(TreeNode):
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -1186,8 +1191,6 @@ class RocnikNode(TreeNode):
|
||||||
rocnik = models.OneToOneField(Rocnik,
|
rocnik = models.OneToOneField(Rocnik,
|
||||||
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 __str__(self):
|
|
||||||
return 'RocnikNode: '+str(self.rocnik)
|
|
||||||
|
|
||||||
class CisloNode(TreeNode):
|
class CisloNode(TreeNode):
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -1197,16 +1200,12 @@ class CisloNode(TreeNode):
|
||||||
cislo = models.OneToOneField(Cislo,
|
cislo = models.OneToOneField(Cislo,
|
||||||
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 __str__(self):
|
|
||||||
return 'CisloNode: '+str(self.cislo)
|
|
||||||
|
|
||||||
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 __str__(self):
|
|
||||||
return 'MezicisloNode'
|
|
||||||
|
|
||||||
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 """
|
||||||
|
@ -1217,8 +1216,6 @@ class TemaVCisleNode(TreeNode):
|
||||||
tema = models.ForeignKey(Tema,
|
tema = models.ForeignKey(Tema,
|
||||||
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 __str__(self):
|
|
||||||
return 'TemaVCisleNode: tema: '+str(self.tema)
|
|
||||||
|
|
||||||
class KonferaNode(TreeNode):
|
class KonferaNode(TreeNode):
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -1230,8 +1227,6 @@ class KonferaNode(TreeNode):
|
||||||
verbose_name = "konfera",
|
verbose_name = "konfera",
|
||||||
null=True,
|
null=True,
|
||||||
blank=False)
|
blank=False)
|
||||||
def __str__(self):
|
|
||||||
return 'KonferaNode: '+str(self.konfera)
|
|
||||||
|
|
||||||
class ClanekNode(TreeNode):
|
class ClanekNode(TreeNode):
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -1243,8 +1238,6 @@ class ClanekNode(TreeNode):
|
||||||
verbose_name = "článek",
|
verbose_name = "článek",
|
||||||
null=True,
|
null=True,
|
||||||
blank=False)
|
blank=False)
|
||||||
def __str__(self):
|
|
||||||
return 'ClanekNode: '+str(self.clanek)
|
|
||||||
|
|
||||||
class UlohaZadaniNode(TreeNode):
|
class UlohaZadaniNode(TreeNode):
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -1256,8 +1249,6 @@ class UlohaZadaniNode(TreeNode):
|
||||||
verbose_name = "úloha",
|
verbose_name = "úloha",
|
||||||
null=True,
|
null=True,
|
||||||
blank=False)
|
blank=False)
|
||||||
def __str__(self):
|
|
||||||
return 'UlohaZadaniNode: '+str(self.uloha)
|
|
||||||
|
|
||||||
class PohadkaNode(TreeNode):
|
class PohadkaNode(TreeNode):
|
||||||
class Meta:
|
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ě
|
on_delete=models.PROTECT, # Pokud chci mazat pohádku, musím si Node pořešit ručně
|
||||||
verbose_name = "pohádka",
|
verbose_name = "pohádka",
|
||||||
)
|
)
|
||||||
def __str__(self):
|
|
||||||
return 'PohadkaNode: '+str(self.pohadka)
|
|
||||||
|
|
||||||
class UlohaVzorakNode(TreeNode):
|
class UlohaVzorakNode(TreeNode):
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -1281,8 +1270,6 @@ class UlohaVzorakNode(TreeNode):
|
||||||
verbose_name = "úloha",
|
verbose_name = "úloha",
|
||||||
null=True,
|
null=True,
|
||||||
blank=False)
|
blank=False)
|
||||||
def __str__(self):
|
|
||||||
return 'UlohaVzorakNode: '+str(self.uloha)
|
|
||||||
|
|
||||||
class TextNode(TreeNode):
|
class TextNode(TreeNode):
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -1292,8 +1279,6 @@ class TextNode(TreeNode):
|
||||||
text = models.ForeignKey(Text,
|
text = models.ForeignKey(Text,
|
||||||
on_delete=models.PROTECT,
|
on_delete=models.PROTECT,
|
||||||
verbose_name = 'text')
|
verbose_name = 'text')
|
||||||
def __str__(self):
|
|
||||||
return 'TextNode: '+str(self.text)
|
|
||||||
|
|
||||||
## FIXME: Logiku přesunout do views.
|
## FIXME: Logiku přesunout do views.
|
||||||
#class VysledkyBase(SeminarModelBase):
|
#class VysledkyBase(SeminarModelBase):
|
||||||
|
|
Loading…
Reference in a new issue