|
|
@ -104,7 +104,7 @@ class Skola(SeminarModelBase): |
|
|
|
blank=True, null=True) |
|
|
|
|
|
|
|
def __str__(self): |
|
|
|
return force_unicode(u'%s, %s, %s' % (self.nazev, self.ulice, self.mesto)) |
|
|
|
return force_unicode(u'%s, %s, %s' % (self.nazev, self.ulice, self.mesto)) |
|
|
|
|
|
|
|
@reversion.register(ignore_duplicates=True) |
|
|
|
@python_2_unicode_compatible |
|
|
@ -1066,6 +1066,84 @@ class Text(SeminarModelBase): |
|
|
|
help_text=u'Text ke zveřejnění v čísle') |
|
|
|
|
|
|
|
# obrázky mají návaznost opačným směrem (vazba z druhé strany) |
|
|
|
class TreeNode(models.Model): |
|
|
|
class Meta: |
|
|
|
abstract = True |
|
|
|
root = models.ForeignKey('self', |
|
|
|
null = True, |
|
|
|
blank = False, |
|
|
|
on_delete = models.SET_NULL, # Vrcholy s null kořenem jsou sirotci bez ročníku |
|
|
|
first_child = models.ForeignKey('self', |
|
|
|
null = True, |
|
|
|
blank = True, |
|
|
|
on_delete=models.SET_NULL, |
|
|
|
verbose_name="první potomek") |
|
|
|
succ = models.ForeignKey('self', |
|
|
|
null = True, |
|
|
|
blank = True, |
|
|
|
on_delete=models.SET_NULL, |
|
|
|
verbose_name="další element na stejné úrovni") |
|
|
|
|
|
|
|
class RocnikNode(TreeNode): |
|
|
|
class Meta: |
|
|
|
db_table = 'seminar_nodes_rocnik' |
|
|
|
verbose_name = 'Ročník (Node)' |
|
|
|
verbose_name_plural = 'Ročníky (Node)' |
|
|
|
rocnik = models.ForeignKey(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") |
|
|
|
|
|
|
|
class CisloNode(TreeNode): |
|
|
|
class Meta: |
|
|
|
db_table = 'seminar_nodes_cislo' |
|
|
|
verbose_name = 'Číslo (Node)' |
|
|
|
verbose_name_plural = 'Čísla (Node)' |
|
|
|
cislo = models.ForeignKey(Cislo, |
|
|
|
on_delete = models.PROTECT, # Pokud chci mazat číslo, musím si Node pořešit ručně |
|
|
|
verbose_name = "číslo") |
|
|
|
|
|
|
|
class MezicisloNode(TreeNode): |
|
|
|
class Meta: |
|
|
|
db_table = 'seminar_nodes_mezicislo' |
|
|
|
verbose_name = 'Mezičíslo (Node)' |
|
|
|
verbose_name_plural = 'Mezičísla (Node)' |
|
|
|
|
|
|
|
class TemaVCisleNode(TreeNode): |
|
|
|
""" Obsahuje příspěvky k tématu v daném čísle """ |
|
|
|
class Meta: |
|
|
|
db_table = 'seminar_nodes_temavcisle' |
|
|
|
verbose_name = 'Téma v čísle (Node)' |
|
|
|
verbose_name_plural = 'Témata v čísle (Node)' |
|
|
|
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") |
|
|
|
|
|
|
|
class KonferaNode(TreeNode): |
|
|
|
class Meta: |
|
|
|
db_table = 'seminar_nodes_konfera' |
|
|
|
verbose_name = 'Konfera (Node)' |
|
|
|
verbose_name_plural = 'Konfery (Node)' |
|
|
|
|
|
|
|
class ClanekNode(TreeNode): |
|
|
|
class Meta: |
|
|
|
db_table = 'seminar_nodes_clanek' |
|
|
|
verbose_name = 'Článek (Node)' |
|
|
|
verbose_name_plural = 'Články (Node)' |
|
|
|
|
|
|
|
class UlohaNode(TreeNode): |
|
|
|
class Meta: |
|
|
|
db_table = 'seminar_nodes_uloha' |
|
|
|
verbose_name = 'Úloha (Node)' |
|
|
|
verbose_name_plural = 'Úlohy (Node)' |
|
|
|
|
|
|
|
class TextNode(TreeNode): |
|
|
|
class Meta: |
|
|
|
db_table = 'seminar_nodes_obsah' |
|
|
|
verbose_name = 'Text (Node)' |
|
|
|
verbose_name_plural = 'Text (Node)' |
|
|
|
text = models.ForeignKey(Text, |
|
|
|
on_delete=models.PROTECT, |
|
|
|
verbose_name = 'text') |
|
|
|
|
|
|
|
## FIXME: Logiku přesunout do views. |
|
|
|
#@python_2_unicode_compatible |
|
|
|