diff --git a/odevzdavatko/migrations/0002_presun_treenode.py b/odevzdavatko/migrations/0002_presun_treenode.py new file mode 100644 index 00000000..f5ef964d --- /dev/null +++ b/odevzdavatko/migrations/0002_presun_treenode.py @@ -0,0 +1,24 @@ +# Generated by Django 2.2.28 on 2023-08-10 07:14 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('odevzdavatko', '0001_initial'), + ] + + operations = [ + migrations.SeparateDatabaseAndState( + state_operations=[ + migrations.AlterField( + model_name='reseni', + name='text_cely', + field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='reseni_cely_set', to='treenode.ReseniNode', verbose_name='Plná verze textu řešení'), + ), + ], + database_operations=[], + ), + ] diff --git a/odevzdavatko/models.py b/odevzdavatko/models.py index 0c39ab5f..e387a374 100644 --- a/odevzdavatko/models.py +++ b/odevzdavatko/models.py @@ -48,7 +48,7 @@ class Reseni(SeminarModelBase): forma = models.CharField('forma řešení', max_length=16, choices=FORMA_CHOICES, blank=False, default=FORMA_EMAIL) - text_cely = models.OneToOneField("seminar.ReseniNode", verbose_name='Plná verze textu řešení', + text_cely = models.OneToOneField("treenode.ReseniNode", verbose_name='Plná verze textu řešení', blank=True, null=True, related_name="reseni_cely_set", on_delete=models.PROTECT) diff --git a/seminar/migrations/0118_separace_treenode.py b/seminar/migrations/0118_separace_treenode.py new file mode 100644 index 00000000..6f66b708 --- /dev/null +++ b/seminar/migrations/0118_separace_treenode.py @@ -0,0 +1,189 @@ +# Generated by Django 2.2.28 on 2023-08-10 07:14 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('odevzdavatko', '0001_initial'), + ('seminar', '0117_separace_soustredeni'), + ] + + operations = [ + migrations.SeparateDatabaseAndState( + state_operations=[ + migrations.RemoveField( + model_name='cislonode', + name='cislo', + ), + migrations.RemoveField( + model_name='cislonode', + name='treenode_ptr', + ), + migrations.RemoveField( + model_name='mezicislonode', + name='treenode_ptr', + ), + migrations.RemoveField( + model_name='orgtextnode', + name='organizator', + ), + migrations.RemoveField( + model_name='orgtextnode', + name='treenode_ptr', + ), + migrations.RemoveField( + model_name='pohadkanode', + name='pohadka', + ), + migrations.RemoveField( + model_name='pohadkanode', + name='treenode_ptr', + ), + migrations.RemoveField( + model_name='reseninode', + name='reseni', + ), + migrations.RemoveField( + model_name='reseninode', + name='treenode_ptr', + ), + migrations.RemoveField( + model_name='rocniknode', + name='rocnik', + ), + migrations.RemoveField( + model_name='rocniknode', + name='treenode_ptr', + ), + migrations.RemoveField( + model_name='temavcislenode', + name='tema', + ), + migrations.RemoveField( + model_name='temavcislenode', + name='treenode_ptr', + ), + migrations.RemoveField( + model_name='textnode', + name='text', + ), + migrations.RemoveField( + model_name='textnode', + name='treenode_ptr', + ), + migrations.RemoveField( + model_name='treenode', + name='first_child', + ), + migrations.RemoveField( + model_name='treenode', + name='polymorphic_ctype', + ), + migrations.RemoveField( + model_name='treenode', + name='root', + ), + migrations.RemoveField( + model_name='treenode', + name='succ', + ), + migrations.RemoveField( + model_name='ulohavzoraknode', + name='treenode_ptr', + ), + migrations.RemoveField( + model_name='ulohavzoraknode', + name='uloha', + ), + migrations.RemoveField( + model_name='ulohazadaninode', + name='treenode_ptr', + ), + migrations.RemoveField( + model_name='ulohazadaninode', + name='uloha', + ), + ], + database_operations=[], + ), + migrations.SeparateDatabaseAndState( + state_operations=[ + migrations.DeleteModel( + name='CastNode', + ), + migrations.DeleteModel( + name='CisloNode', + ), + migrations.DeleteModel( + name='MezicisloNode', + ), + migrations.DeleteModel( + name='OrgTextNode', + ), + migrations.DeleteModel( + name='PohadkaNode', + ), + migrations.DeleteModel( + name='ReseniNode', + ), + migrations.DeleteModel( + name='RocnikNode', + ), + migrations.DeleteModel( + name='TemaVCisleNode', + ), + migrations.DeleteModel( + name='TextNode', + ), + migrations.DeleteModel( + name='TreeNode', + ), + migrations.DeleteModel( + name='UlohaVzorakNode', + ), + migrations.DeleteModel( + name='UlohaZadaniNode', + ), + ], + database_operations=[ + migrations.AlterModelTable( + name='TreeNode', table="mam_nodes_treenode", + ), + migrations.AlterModelTable( + name='CastNode', table="mam_nodes_cast", + ), + migrations.AlterModelTable( + name='MezicisloNode', table="mam_nodes_mezicislo", + ), + migrations.AlterModelTable( + name='UlohaZadaniNode', table="mam_nodes_uloha_zadani", + ), + migrations.AlterModelTable( + name='UlohaVzorakNode', table="mam_nodes_uloha_vzorak", + ), + migrations.AlterModelTable( + name='TextNode', table="mam_nodes_obsah", + ), + migrations.AlterModelTable( + name='TemaVCisleNode', table="mam_nodes_temavcisle", + ), + migrations.AlterModelTable( + name='RocnikNode', table="mam_nodes_rocnik", + ), + migrations.AlterModelTable( + name='ReseniNode', table="mam_nodes_otistene_reseni", + ), + migrations.AlterModelTable( + name='PohadkaNode', table="mam_nodes_pohadka", + ), + migrations.AlterModelTable( + name='OrgTextNode', table="mam_nodes_orgtextnode", + ), + migrations.AlterModelTable( + name='CisloNode', table="mam_nodes_cislo", + ), + ], + ), + ] diff --git a/treenode/migrations/0001_initial.py b/treenode/migrations/0001_initial.py new file mode 100644 index 00000000..fcfca6e1 --- /dev/null +++ b/treenode/migrations/0001_initial.py @@ -0,0 +1,186 @@ +# Generated by Django 2.2.28 on 2023-08-10 07:14 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('contenttypes', '0002_remove_content_type_name'), + ('personalni', '0002_organizator_osoba_prijemce_resitel_skola'), + ('odevzdavatko', '0002_presun_treenode'), + ('tvorba', '0001_initial'), + ('seminar', '0118_separace_treenode'), + ] + + operations = [ + migrations.SeparateDatabaseAndState( + state_operations=[ + migrations.CreateModel( + name='TreeNode', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('nazev', models.TextField(help_text='Tento název se zobrazuje v nabídkách pro výběr vhodného TreeNode', null=True, verbose_name='název tohoto node')), + ('zajimave', models.BooleanField(default=False, help_text='Zobrazí se daná věc na rozcestníku témátek', verbose_name='Zajímavé')), + ('srolovatelne', models.BooleanField(blank=True, help_text='Bude na stránce témátka možnost tuto položku skrýt', null=True, verbose_name='Srolovatelné')), + ('first_child', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='father_of_first', to='treenode.TreeNode', verbose_name='první potomek')), + ('polymorphic_ctype', models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='polymorphic_treenode.treenode_set+', to='contenttypes.ContentType')), + ('root', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='potomci_set', to='treenode.TreeNode', verbose_name='kořen stromu')), + ('succ', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='prev', to='treenode.TreeNode', verbose_name='další element na stejné úrovni')), + ], + options={ + 'verbose_name': 'TreeNode', + 'verbose_name_plural': 'TreeNody', + 'db_table': 'mam_nodes_treenode', + }, + ), + migrations.CreateModel( + name='CastNode', + fields=[ + ('treenode_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='treenode.TreeNode')), + ('nadpis', models.CharField(help_text='Nadpis podvěšené části obsahu', max_length=100, verbose_name='Nadpis')), + ], + options={ + 'verbose_name': 'Část (Node)', + 'verbose_name_plural': 'Části (Node)', + 'db_table': 'mam_nodes_cast', + }, + bases=('treenode.treenode',), + ), + migrations.CreateModel( + name='MezicisloNode', + fields=[ + ('treenode_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='treenode.TreeNode')), + ], + options={ + 'verbose_name': 'Mezičíslo (Node)', + 'verbose_name_plural': 'Mezičísla (Node)', + 'db_table': 'mam_nodes_mezicislo', + }, + bases=('treenode.treenode',), + ), + migrations.CreateModel( + name='UlohaZadaniNode', + fields=[ + ('treenode_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='treenode.TreeNode')), + ('uloha', models.OneToOneField(null=True, on_delete=django.db.models.deletion.PROTECT, to='tvorba.Uloha', verbose_name='úloha')), + ], + options={ + 'verbose_name': 'Zadání úlohy (Node)', + 'verbose_name_plural': 'Zadání úloh (Node)', + 'db_table': 'mam_nodes_uloha_zadani', + }, + bases=('treenode.treenode',), + ), + migrations.CreateModel( + name='UlohaVzorakNode', + fields=[ + ('treenode_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='treenode.TreeNode')), + ('uloha', models.OneToOneField(null=True, on_delete=django.db.models.deletion.PROTECT, to='tvorba.Uloha', verbose_name='úloha')), + ], + options={ + 'verbose_name': 'Vzorák úlohy (Node)', + 'verbose_name_plural': 'Vzoráky úloh (Node)', + 'db_table': 'mam_nodes_uloha_vzorak', + }, + bases=('treenode.treenode',), + ), + migrations.CreateModel( + name='TextNode', + fields=[ + ('treenode_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='treenode.TreeNode')), + ('text', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='seminar.Text', verbose_name='text')), + ], + options={ + 'verbose_name': 'Text (Node)', + 'verbose_name_plural': 'Text (Node)', + 'db_table': 'mam_nodes_obsah', + }, + bases=('treenode.treenode',), + ), + migrations.CreateModel( + name='TemaVCisleNode', + fields=[ + ('treenode_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='treenode.TreeNode')), + ('tema', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='tvorba.Tema', verbose_name='téma v čísle')), + ], + options={ + 'verbose_name': 'Téma v čísle (Node)', + 'verbose_name_plural': 'Témata v čísle (Node)', + 'db_table': 'mam_nodes_temavcisle', + }, + bases=('treenode.treenode',), + ), + migrations.CreateModel( + name='RocnikNode', + fields=[ + ('treenode_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='treenode.TreeNode')), + ('rocnik', models.OneToOneField(on_delete=django.db.models.deletion.PROTECT, to='tvorba.Rocnik', verbose_name='ročník')), + ], + options={ + 'verbose_name': 'Ročník (Node)', + 'verbose_name_plural': 'Ročníky (Node)', + 'db_table': 'mam_nodes_rocnik', + }, + bases=('treenode.treenode',), + ), + migrations.CreateModel( + name='ReseniNode', + fields=[ + ('treenode_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='treenode.TreeNode')), + ('reseni', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='odevzdavatko.Reseni', verbose_name='reseni')), + ], + options={ + 'verbose_name': 'Otištěné řešení (Node)', + 'verbose_name_plural': 'Otištěná řešení (Node)', + 'db_table': 'mam_nodes_otistene_reseni', + }, + bases=('treenode.treenode',), + ), + migrations.CreateModel( + name='PohadkaNode', + fields=[ + ('treenode_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='treenode.TreeNode')), + ('pohadka', models.OneToOneField(on_delete=django.db.models.deletion.PROTECT, to='tvorba.Pohadka', verbose_name='pohádka')), + ], + options={ + 'verbose_name': 'Pohádka (Node)', + 'verbose_name_plural': 'Pohádky (Node)', + 'db_table': 'mam_nodes_pohadka', + }, + bases=('treenode.treenode',), + ), + migrations.CreateModel( + name='OrgTextNode', + fields=[ + ('treenode_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='treenode.TreeNode')), + ('org_verejny', models.BooleanField(default=True, help_text='Pokud ano, bude org pod článkem podepsaný', verbose_name='Org je veřejný?')), + ('organizator', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='personalni.Organizator', verbose_name='Organizátor')), + ], + options={ + 'verbose_name': 'Organizátorský článek (Node)', + 'verbose_name_plural': 'Organizátorské články (Node)', + 'db_table': 'mam_nodes_orgtextnode', + }, + bases=('treenode.treenode',), + ), + migrations.CreateModel( + name='CisloNode', + fields=[ + ('treenode_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='treenode.TreeNode')), + ('cislo', models.OneToOneField(on_delete=django.db.models.deletion.PROTECT, to='tvorba.Cislo', verbose_name='číslo')), + ], + options={ + 'verbose_name': 'Číslo (Node)', + 'verbose_name_plural': 'Čísla (Node)', + 'db_table': 'mam_nodes_cislo', + }, + bases=('treenode.treenode',), + ), + ], + database_operations=[], + ), + ] diff --git a/treenode/models.py b/treenode/models.py index 3080162b..7f68492e 100644 --- a/treenode/models.py +++ b/treenode/models.py @@ -19,7 +19,7 @@ from tvorba.models import Rocnik, Cislo, Tema, Uloha, Pohadka class TreeNode(PolymorphicModel): class Meta: - db_table = "seminar_nodes_treenode" + db_table = "mam_nodes_treenode" verbose_name = "TreeNode" verbose_name_plural = "TreeNody" @@ -93,7 +93,7 @@ class TreeNode(PolymorphicModel): class RocnikNode(TreeNode): class Meta: - db_table = 'seminar_nodes_rocnik' + db_table = 'mam_nodes_rocnik' verbose_name = 'Ročník (Node)' verbose_name_plural = 'Ročníky (Node)' rocnik = models.OneToOneField(Rocnik, @@ -105,7 +105,7 @@ class RocnikNode(TreeNode): class CisloNode(TreeNode): class Meta: - db_table = 'seminar_nodes_cislo' + db_table = 'mam_nodes_cislo' verbose_name = 'Číslo (Node)' verbose_name_plural = 'Čísla (Node)' cislo = models.OneToOneField(Cislo, @@ -120,7 +120,7 @@ class CisloNode(TreeNode): class MezicisloNode(TreeNode): class Meta: - db_table = 'seminar_nodes_mezicislo' + db_table = 'mam_nodes_mezicislo' verbose_name = 'Mezičíslo (Node)' verbose_name_plural = 'Mezičísla (Node)' @@ -147,7 +147,7 @@ class MezicisloNode(TreeNode): class TemaVCisleNode(TreeNode): """ Obsahuje příspěvky k tématu v daném čísle """ class Meta: - db_table = 'seminar_nodes_temavcisle' + db_table = 'mam_nodes_temavcisle' verbose_name = 'Téma v čísle (Node)' verbose_name_plural = 'Témata v čísle (Node)' tema = models.ForeignKey(Tema, @@ -162,7 +162,7 @@ class TemaVCisleNode(TreeNode): class OrgTextNode(TreeNode): class Meta: - db_table = 'seminar_nodes_orgtextnode' + db_table = 'mam_nodes_orgtextnode' verbose_name = 'Organizátorský článek (Node)' verbose_name_plural = 'Organizátorské články (Node)' @@ -188,7 +188,7 @@ class OrgTextNode(TreeNode): class UlohaZadaniNode(TreeNode): class Meta: - db_table = 'seminar_nodes_uloha_zadani' + db_table = 'mam_nodes_uloha_zadani' verbose_name = 'Zadání úlohy (Node)' verbose_name_plural = 'Zadání úloh (Node)' uloha = models.OneToOneField(Uloha, @@ -206,7 +206,7 @@ class UlohaZadaniNode(TreeNode): class PohadkaNode(TreeNode): class Meta: - db_table = 'seminar_nodes_pohadka' + db_table = 'mam_nodes_pohadka' verbose_name = 'Pohádka (Node)' verbose_name_plural = 'Pohádky (Node)' pohadka = models.OneToOneField(Pohadka, @@ -219,7 +219,7 @@ class PohadkaNode(TreeNode): class UlohaVzorakNode(TreeNode): class Meta: - db_table = 'seminar_nodes_uloha_vzorak' + db_table = 'mam_nodes_uloha_vzorak' verbose_name = 'Vzorák úlohy (Node)' verbose_name_plural = 'Vzoráky úloh (Node)' uloha = models.OneToOneField(Uloha, @@ -237,7 +237,7 @@ class UlohaVzorakNode(TreeNode): class TextNode(TreeNode): class Meta: - db_table = 'seminar_nodes_obsah' + db_table = 'mam_nodes_obsah' verbose_name = 'Text (Node)' verbose_name_plural = 'Text (Node)' text = models.ForeignKey(Text, @@ -253,7 +253,7 @@ class TextNode(TreeNode): class CastNode(TreeNode): class Meta: - db_table = 'seminar_nodes_cast' + db_table = 'mam_nodes_cast' verbose_name = 'Část (Node)' verbose_name_plural = 'Části (Node)' @@ -268,7 +268,7 @@ class CastNode(TreeNode): class ReseniNode(TreeNode): class Meta: - db_table = 'seminar_nodes_otistene_reseni' + db_table = 'mam_nodes_otistene_reseni' verbose_name = 'Otištěné řešení (Node)' verbose_name_plural = 'Otištěná řešení (Node)' reseni = models.ForeignKey(Reseni,