Browse Source

Model PohádkaNode + úprava příslušné migrace, která vytváří *Node

export_seznamu_prednasek
Pavel "LEdoian" Turinsky 6 years ago
parent
commit
77cbe6ed31
  1. 13
      seminar/migrations/0050_auto_20190510_2228.py
  2. 11
      seminar/models.py

13
seminar/migrations/0050_auto_20190510_2228.py

@ -160,6 +160,19 @@ class Migration(migrations.Migration):
},
bases=('seminar.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='seminar.TreeNode')),
('pohadka', models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='seminar.Pohadka', verbose_name='pohádka')),
],
options={
'verbose_name': 'Pohádka (Node)',
'verbose_name_plural': 'Pohádky (Node)',
'db_table': 'seminar_nodes_pohadka',
},
bases=('seminar.treenode',),
),
migrations.AddField(
model_name='treenode',
name='first_child',

11
seminar/models.py

@ -1178,6 +1178,17 @@ class UlohaZadaniNode(TreeNode):
null=True,
blank=False)
class PohadkaNode(TreeNode):
class Meta:
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ě
verbose_name = "pohádka",
null=True,
blank=False)
class UlohaVzorakNode(TreeNode):
class Meta:
db_table = 'seminar_nodes_uloha_vzorak'

Loading…
Cancel
Save