|
|
@ -45,11 +45,6 @@ class SeminarModelBase(models.Model): |
|
|
|
def verejne_url(self): |
|
|
|
return None |
|
|
|
|
|
|
|
# |
|
|
|
# Mělo by být částečně vytaženo z Aesopa |
|
|
|
# viz https://ovvp.mff.cuni.cz/wiki/aesop/export-skol. |
|
|
|
# |
|
|
|
|
|
|
|
@reversion.register(ignore_duplicates=True) |
|
|
|
@python_2_unicode_compatible |
|
|
|
class Osoba(SeminarModelBase): |
|
|
@ -129,6 +124,10 @@ class Osoba(SeminarModelBase): |
|
|
|
def __str__(self): |
|
|
|
return force_unicode("Osoba({})".format(self.plne_jmeno())) |
|
|
|
|
|
|
|
# |
|
|
|
# Mělo by být částečně vytaženo z Aesopa |
|
|
|
# viz https://ovvp.mff.cuni.cz/wiki/aesop/export-skol. |
|
|
|
# |
|
|
|
|
|
|
|
@reversion.register(ignore_duplicates=True) |
|
|
|
@python_2_unicode_compatible |
|
|
@ -290,6 +289,8 @@ class Resitel(SeminarModelBase): |
|
|
|
return 'Prof.' |
|
|
|
else: |
|
|
|
return 'Akad.' |
|
|
|
def __str__(): |
|
|
|
return(force_unicode(u"Řešitel ({})".format(self.osoba.plne_jmeno()))) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -493,7 +494,6 @@ class Organizator(SeminarModelBase): |
|
|
|
verbose_name = 'Organizátor' |
|
|
|
verbose_name_plural = 'Organizátoři' |
|
|
|
|
|
|
|
|
|
|
|
@reversion.register(ignore_duplicates=True) |
|
|
|
@python_2_unicode_compatible |
|
|
|
class Soustredeni(SeminarModelBase): |
|
|
@ -1092,6 +1092,88 @@ 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 Meta: |
|
|
|
abstract = True |
|
|
|
root = models.ForeignKey('self', |
|
|
|
related_name="potomci_set", |
|
|
|
null = True, |
|
|
|
blank = False, |
|
|
|
on_delete = models.SET_NULL, # Vrcholy s null kořenem jsou sirotci bez ročníku |
|
|
|
verbose_name="kořen stromu") |
|
|
|
first_child = models.ForeignKey('self', |
|
|
|
null = True, |
|
|
|
blank = True, |
|
|
|
on_delete=models.SET_NULL, |
|
|
|
verbose_name="první potomek") |
|
|
|
succ = models.ForeignKey('self', |
|
|
|
related_name="prev", |
|
|
|
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 |
|
|
|
#class VysledkyBase(SeminarModelBase): |
|
|
|