From 7d84285e86c2dfbfabf7b1abf9d59afd6d520566 Mon Sep 17 00:00:00 2001 From: "Pavel \"LEdoian\" Turinsky" Date: Thu, 30 May 2019 01:41:11 +0200 Subject: [PATCH] =?UTF-8?q?Poh=C3=A1dka=20m=C3=A1=20b=C3=BDt=20OneToOneFie?= =?UTF-8?q?ld?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seminar/migrations/0050_auto_20190510_2228.py | 2 +- seminar/models.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/seminar/migrations/0050_auto_20190510_2228.py b/seminar/migrations/0050_auto_20190510_2228.py index e0594be7..7efe52a7 100644 --- a/seminar/migrations/0050_auto_20190510_2228.py +++ b/seminar/migrations/0050_auto_20190510_2228.py @@ -164,7 +164,7 @@ class Migration(migrations.Migration): 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='seminar.TreeNode')), - ('pohadka', models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='seminar.Pohadka', verbose_name='pohádka')), + ('pohadka', models.OneToOneField(on_delete=django.db.models.deletion.PROTECT, to='seminar.Pohadka', verbose_name='pohádka')), ], options={ 'verbose_name': 'Pohádka (Node)', diff --git a/seminar/models.py b/seminar/models.py index a4c3211f..f867991a 100644 --- a/seminar/models.py +++ b/seminar/models.py @@ -1183,11 +1183,10 @@ class PohadkaNode(TreeNode): db_table = 'seminar_nodes_pohadka' verbose_name = 'Pohádka (Node)' verbose_name_plural = 'Pohádky (Node)' - pohadka = models.ForeignKey(Pohadka, - on_delete=models.PROTECT, # Pokud chci mazat téma, musím si Node pořešit ručně + pohadka = models.OneToOneField(Pohadka, + on_delete=models.PROTECT, # Pokud chci mazat pohádku, musím si Node pořešit ručně verbose_name = "pohádka", - null=True, - blank=False) + ) class UlohaVzorakNode(TreeNode): class Meta: