Pohádka má být OneToOneField
This commit is contained in:
parent
00d16bd25f
commit
7d84285e86
2 changed files with 4 additions and 5 deletions
|
@ -164,7 +164,7 @@ class Migration(migrations.Migration):
|
||||||
name='PohadkaNode',
|
name='PohadkaNode',
|
||||||
fields=[
|
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')),
|
('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={
|
options={
|
||||||
'verbose_name': 'Pohádka (Node)',
|
'verbose_name': 'Pohádka (Node)',
|
||||||
|
|
|
@ -1183,11 +1183,10 @@ class PohadkaNode(TreeNode):
|
||||||
db_table = 'seminar_nodes_pohadka'
|
db_table = 'seminar_nodes_pohadka'
|
||||||
verbose_name = 'Pohádka (Node)'
|
verbose_name = 'Pohádka (Node)'
|
||||||
verbose_name_plural = 'Pohádky (Node)'
|
verbose_name_plural = 'Pohádky (Node)'
|
||||||
pohadka = models.ForeignKey(Pohadka,
|
pohadka = models.OneToOneField(Pohadka,
|
||||||
on_delete=models.PROTECT, # Pokud chci mazat téma, musím si Node pořešit ručně
|
on_delete=models.PROTECT, # Pokud chci mazat pohádku, musím si Node pořešit ručně
|
||||||
verbose_name = "pohádka",
|
verbose_name = "pohádka",
|
||||||
null=True,
|
)
|
||||||
blank=False)
|
|
||||||
|
|
||||||
class UlohaVzorakNode(TreeNode):
|
class UlohaVzorakNode(TreeNode):
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
Loading…
Reference in a new issue