|
|
@ -25,6 +25,7 @@ from seminar.utils import roman |
|
|
|
|
|
|
|
from unidecode import unidecode |
|
|
|
|
|
|
|
from polymorphic.models import PolymorphicModel |
|
|
|
|
|
|
|
class SeminarModelBase(models.Model): |
|
|
|
|
|
|
@ -1139,7 +1140,7 @@ class Obrazek(SeminarModelBase): |
|
|
|
help_text = 'Černobílá verze obrázku do čísla', |
|
|
|
upload_to = 'obrazky/%Y/%m/%d/', blank=True, null=True) |
|
|
|
|
|
|
|
class TreeNode(models.Model): |
|
|
|
class TreeNode(PolymorphicModel): |
|
|
|
class Meta: |
|
|
|
db_table = "seminar_nodes_treenode" |
|
|
|
verbose_name = "TreeNode" |
|
|
@ -1170,6 +1171,8 @@ class TreeNode(models.Model): |
|
|
|
if self.succ: |
|
|
|
self.succ.print_tree(indent=indent) |
|
|
|
|
|
|
|
def __str__(self): |
|
|
|
return "Generický TreeNode!" |
|
|
|
|
|
|
|
class RocnikNode(TreeNode): |
|
|
|
class Meta: |
|
|
@ -1179,6 +1182,8 @@ 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: |
|
|
@ -1188,12 +1193,16 @@ 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 """ |
|
|
@ -1204,6 +1213,8 @@ 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: |
|
|
@ -1215,6 +1226,8 @@ class KonferaNode(TreeNode): |
|
|
|
verbose_name = "konfera", |
|
|
|
null=True, |
|
|
|
blank=False) |
|
|
|
def __str__(self): |
|
|
|
return 'KonferaNode: '+str(self.konfera) |
|
|
|
|
|
|
|
class ClanekNode(TreeNode): |
|
|
|
class Meta: |
|
|
@ -1226,6 +1239,8 @@ class ClanekNode(TreeNode): |
|
|
|
verbose_name = "článek", |
|
|
|
null=True, |
|
|
|
blank=False) |
|
|
|
def __str__(self): |
|
|
|
return 'ClanekNode: '+str(self.clanek) |
|
|
|
|
|
|
|
class UlohaZadaniNode(TreeNode): |
|
|
|
class Meta: |
|
|
@ -1237,6 +1252,8 @@ class UlohaZadaniNode(TreeNode): |
|
|
|
verbose_name = "úloha", |
|
|
|
null=True, |
|
|
|
blank=False) |
|
|
|
def __str__(self): |
|
|
|
return 'UlohaZadaniNode: '+str(self.uloha) |
|
|
|
|
|
|
|
class PohadkaNode(TreeNode): |
|
|
|
class Meta: |
|
|
@ -1247,6 +1264,8 @@ 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: |
|
|
@ -1258,6 +1277,8 @@ class UlohaVzorakNode(TreeNode): |
|
|
|
verbose_name = "úloha", |
|
|
|
null=True, |
|
|
|
blank=False) |
|
|
|
def __str__(self): |
|
|
|
return 'UlohaVzorakNode: '+str(self.uloha) |
|
|
|
|
|
|
|
class TextNode(TreeNode): |
|
|
|
class Meta: |
|
|
@ -1267,6 +1288,8 @@ 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): |
|
|
|