Merge branch 'python3' of gimli.ms.mff.cuni.cz:/akce/mam/git/mamweb into python3
This commit is contained in:
commit
4d42324f63
3 changed files with 89 additions and 7 deletions
BIN
Schema_new.dia
BIN
Schema_new.dia
Binary file not shown.
|
@ -133,7 +133,7 @@ class ProblemAutocomplete(autocomplete_light.AutocompleteModelBase):
|
|||
'class': 'modern-style',
|
||||
}
|
||||
|
||||
# FIXME: nefunguje, nevime proc.
|
||||
#FIXME Nefunguje, nevime proc
|
||||
#autocomplete_light.register(ProblemAutocomplete)
|
||||
|
||||
|
||||
|
|
|
@ -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):
|
||||
|
@ -130,6 +125,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
|
||||
|
@ -291,6 +290,8 @@ class Resitel(SeminarModelBase):
|
|||
return 'Prof.'
|
||||
else:
|
||||
return 'Akad.'
|
||||
def __str__():
|
||||
return(force_unicode(u"Řešitel ({})".format(self.osoba.plne_jmeno())))
|
||||
|
||||
|
||||
|
||||
|
@ -494,7 +495,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):
|
||||
|
|
Loading…
Reference in a new issue