diff --git a/Schema_new.dia b/Schema_new.dia index d7a38dbd..536c3c48 100644 Binary files a/Schema_new.dia and b/Schema_new.dia differ diff --git a/seminar/migrations/0050_auto_20190510_2228.py b/seminar/migrations/0050_auto_20190510_2228.py index 4226380a..fe82dbfc 100644 --- a/seminar/migrations/0050_auto_20190510_2228.py +++ b/seminar/migrations/0050_auto_20190510_2228.py @@ -112,19 +112,53 @@ class Migration(migrations.Migration): }, ), migrations.CreateModel( - name='UlohaNode', + name='UlohaVzorakNode', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('first_child', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='seminar.UlohaNode', verbose_name='první potomek')), - ('root', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='potomci_set', to='seminar.UlohaNode', verbose_name='kořen stromu')), - ('succ', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='prev', to='seminar.UlohaNode', verbose_name='další element na stejné úrovni')), + ('first_child', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='seminar.UlohaVzorakNode', verbose_name='první potomek')), + ('root', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='potomci_set', to='seminar.UlohaVzorakNode', verbose_name='kořen stromu')), + ('succ', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='prev', to='seminar.UlohaVzorakNode', verbose_name='další element na stejné úrovni')), ], options={ - 'verbose_name': 'Úloha (Node)', - 'verbose_name_plural': 'Úlohy (Node)', - 'db_table': 'seminar_nodes_uloha', + 'verbose_name': 'Vzorák úlohy (Node)', + 'verbose_name_plural': 'Vzoráky úloh (Node)', + 'db_table': 'seminar_nodes_uloha_vzorak', }, ), + migrations.CreateModel( + name='UlohaZadaniNode', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('first_child', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='seminar.UlohaZadaniNode', verbose_name='první potomek')), + ('root', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='potomci_set', to='seminar.UlohaZadaniNode', verbose_name='kořen stromu')), + ('succ', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='prev', to='seminar.UlohaZadaniNode', verbose_name='další element na stejné úrovni')), + ], + options={ + 'verbose_name': 'Zadání úlohy (Node)', + 'verbose_name_plural': 'Zadání úloh (Node)', + 'db_table': 'seminar_nodes_uloha_zadani', + }, + ), + migrations.AddField( + model_name='claneknode', + name='clanek', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='seminar.Clanek', verbose_name='článek'), + ), + migrations.AddField( + model_name='konferanode', + name='konfera', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='seminar.Konfera', verbose_name='konfera'), + ), + migrations.AddField( + model_name='ulohavzoraknode', + name='uloha', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='seminar.Uloha', verbose_name='úloha'), + ), + migrations.AddField( + model_name='ulohazadaninode', + name='uloha', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='seminar.Uloha', verbose_name='úloha'), + ), migrations.AlterField( model_name='konfera', name='reseni', diff --git a/seminar/models.py b/seminar/models.py index f5dd6703..e4d3d34f 100644 --- a/seminar/models.py +++ b/seminar/models.py @@ -1144,18 +1144,44 @@ class KonferaNode(TreeNode): db_table = 'seminar_nodes_konfera' verbose_name = 'Konfera (Node)' verbose_name_plural = 'Konfery (Node)' + konfera = models.ForeignKey(Konfera, + on_delete=models.PROTECT, # Pokud chci mazat téma, musím si Node pořešit ručně + verbose_name = "konfera", + null=True, + blank=False) class ClanekNode(TreeNode): class Meta: db_table = 'seminar_nodes_clanek' verbose_name = 'Článek (Node)' verbose_name_plural = 'Články (Node)' + clanek = models.ForeignKey(Clanek, + on_delete=models.PROTECT, # Pokud chci mazat téma, musím si Node pořešit ručně + verbose_name = "článek", + null=True, + blank=False) + +class UlohaZadaniNode(TreeNode): + class Meta: + db_table = 'seminar_nodes_uloha_zadani' + verbose_name = 'Zadání úlohy (Node)' + verbose_name_plural = 'Zadání úloh (Node)' + uloha = models.ForeignKey(Uloha, + on_delete=models.PROTECT, # Pokud chci mazat téma, musím si Node pořešit ručně + verbose_name = "úloha", + null=True, + blank=False) -class UlohaNode(TreeNode): +class UlohaVzorakNode(TreeNode): class Meta: - db_table = 'seminar_nodes_uloha' - verbose_name = 'Úloha (Node)' - verbose_name_plural = 'Úlohy (Node)' + db_table = 'seminar_nodes_uloha_vzorak' + verbose_name = 'Vzorák úlohy (Node)' + verbose_name_plural = 'Vzoráky úloh (Node)' + uloha = models.ForeignKey(Uloha, + on_delete=models.PROTECT, # Pokud chci mazat téma, musím si Node pořešit ručně + verbose_name = "úloha", + null=True, + blank=False) class TextNode(TreeNode): class Meta: