TreeNode odabstrahovano.
This commit is contained in:
parent
ddbc169f49
commit
69f9b54e7b
2 changed files with 139 additions and 160 deletions
|
@ -13,152 +13,6 @@ class Migration(migrations.Migration):
|
|||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='CisloNode',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Číslo (Node)',
|
||||
'verbose_name_plural': 'Čísla (Node)',
|
||||
'db_table': 'seminar_nodes_cislo',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='ClanekNode',
|
||||
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.ClanekNode', verbose_name='první potomek')),
|
||||
('root', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='potomci_set', to='seminar.ClanekNode', 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.ClanekNode', verbose_name='další element na stejné úrovni')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Článek (Node)',
|
||||
'verbose_name_plural': 'Články (Node)',
|
||||
'db_table': 'seminar_nodes_clanek',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='KonferaNode',
|
||||
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.KonferaNode', verbose_name='první potomek')),
|
||||
('root', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='potomci_set', to='seminar.KonferaNode', 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.KonferaNode', verbose_name='další element na stejné úrovni')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Konfera (Node)',
|
||||
'verbose_name_plural': 'Konfery (Node)',
|
||||
'db_table': 'seminar_nodes_konfera',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='MezicisloNode',
|
||||
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.MezicisloNode', verbose_name='první potomek')),
|
||||
('root', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='potomci_set', to='seminar.MezicisloNode', 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.MezicisloNode', verbose_name='další element na stejné úrovni')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Mezičíslo (Node)',
|
||||
'verbose_name_plural': 'Mezičísla (Node)',
|
||||
'db_table': 'seminar_nodes_mezicislo',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='RocnikNode',
|
||||
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.RocnikNode', verbose_name='první potomek')),
|
||||
('rocnik', models.OneToOneField(on_delete=django.db.models.deletion.PROTECT, to='seminar.Rocnik', verbose_name='ročník')),
|
||||
('root', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='potomci_set', to='seminar.RocnikNode', 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.RocnikNode', verbose_name='další element na stejné úrovni')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Ročník (Node)',
|
||||
'verbose_name_plural': 'Ročníky (Node)',
|
||||
'db_table': 'seminar_nodes_rocnik',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='TemaVCisleNode',
|
||||
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.TemaVCisleNode', verbose_name='první potomek')),
|
||||
('root', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='potomci_set', to='seminar.TemaVCisleNode', 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.TemaVCisleNode', verbose_name='další element na stejné úrovni')),
|
||||
('tema', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.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': 'seminar_nodes_temavcisle',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='TextNode',
|
||||
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.TextNode', verbose_name='první potomek')),
|
||||
('root', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='potomci_set', to='seminar.TextNode', 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.TextNode', verbose_name='další element na stejné úrovni')),
|
||||
('text', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Text', verbose_name='text')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Text (Node)',
|
||||
'verbose_name_plural': 'Text (Node)',
|
||||
'db_table': 'seminar_nodes_obsah',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
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.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': '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',
|
||||
|
@ -189,24 +43,146 @@ class Migration(migrations.Migration):
|
|||
name='zadani',
|
||||
field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='uloha_zadani_set', to='seminar.Text', verbose_name='veřejné zadání'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='cislonode',
|
||||
name='cislo',
|
||||
field=models.OneToOneField(on_delete=django.db.models.deletion.PROTECT, to='seminar.Cislo', verbose_name='číslo'),
|
||||
migrations.CreateModel(
|
||||
name='TreeNode',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'TreeNode',
|
||||
'verbose_name_plural': 'TreeNody',
|
||||
'db_table': 'seminar_nodes_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='seminar.TreeNode')),
|
||||
('cislo', models.OneToOneField(on_delete=django.db.models.deletion.PROTECT, to='seminar.Cislo', verbose_name='číslo')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Číslo (Node)',
|
||||
'verbose_name_plural': 'Čísla (Node)',
|
||||
'db_table': 'seminar_nodes_cislo',
|
||||
},
|
||||
bases=('seminar.treenode',),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='ClanekNode',
|
||||
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')),
|
||||
('clanek', models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='seminar.Clanek', verbose_name='článek')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Článek (Node)',
|
||||
'verbose_name_plural': 'Články (Node)',
|
||||
'db_table': 'seminar_nodes_clanek',
|
||||
},
|
||||
bases=('seminar.treenode',),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='KonferaNode',
|
||||
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')),
|
||||
('konfera', models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='seminar.Konfera', verbose_name='konfera')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Konfera (Node)',
|
||||
'verbose_name_plural': 'Konfery (Node)',
|
||||
'db_table': 'seminar_nodes_konfera',
|
||||
},
|
||||
bases=('seminar.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='seminar.TreeNode')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Mezičíslo (Node)',
|
||||
'verbose_name_plural': 'Mezičísla (Node)',
|
||||
'db_table': 'seminar_nodes_mezicislo',
|
||||
},
|
||||
bases=('seminar.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='seminar.TreeNode')),
|
||||
('rocnik', models.OneToOneField(on_delete=django.db.models.deletion.PROTECT, to='seminar.Rocnik', verbose_name='ročník')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Ročník (Node)',
|
||||
'verbose_name_plural': 'Ročníky (Node)',
|
||||
'db_table': 'seminar_nodes_rocnik',
|
||||
},
|
||||
bases=('seminar.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='seminar.TreeNode')),
|
||||
('tema', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.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': 'seminar_nodes_temavcisle',
|
||||
},
|
||||
bases=('seminar.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='seminar.TreeNode')),
|
||||
('text', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Text', verbose_name='text')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Text (Node)',
|
||||
'verbose_name_plural': 'Text (Node)',
|
||||
'db_table': 'seminar_nodes_obsah',
|
||||
},
|
||||
bases=('seminar.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='seminar.TreeNode')),
|
||||
('uloha', models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='seminar.Uloha', verbose_name='úloha')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Vzorák úlohy (Node)',
|
||||
'verbose_name_plural': 'Vzoráky úloh (Node)',
|
||||
'db_table': 'seminar_nodes_uloha_vzorak',
|
||||
},
|
||||
bases=('seminar.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='seminar.TreeNode')),
|
||||
('uloha', models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='seminar.Uloha', verbose_name='úloha')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Zadání úlohy (Node)',
|
||||
'verbose_name_plural': 'Zadání úloh (Node)',
|
||||
'db_table': 'seminar_nodes_uloha_zadani',
|
||||
},
|
||||
bases=('seminar.treenode',),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='cislonode',
|
||||
model_name='treenode',
|
||||
name='first_child',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='seminar.CisloNode', verbose_name='první potomek'),
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='seminar.TreeNode', verbose_name='první potomek'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='cislonode',
|
||||
model_name='treenode',
|
||||
name='root',
|
||||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='potomci_set', to='seminar.CisloNode', verbose_name='kořen stromu'),
|
||||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='potomci_set', to='seminar.TreeNode', verbose_name='kořen stromu'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='cislonode',
|
||||
model_name='treenode',
|
||||
name='succ',
|
||||
field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='prev', to='seminar.CisloNode', verbose_name='další element na stejné úrovni'),
|
||||
field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='prev', to='seminar.TreeNode', verbose_name='další element na stejné úrovni'),
|
||||
),
|
||||
]
|
||||
|
|
|
@ -1086,19 +1086,22 @@ class Obrazek(SeminarModelBase):
|
|||
|
||||
class TreeNode(models.Model):
|
||||
class Meta:
|
||||
abstract = True
|
||||
root = models.ForeignKey('self',
|
||||
db_table = "seminar_nodes_treenode"
|
||||
verbose_name = "TreeNode"
|
||||
verbose_name_plural = "TreeNody"
|
||||
|
||||
root = models.ForeignKey('TreeNode',
|
||||
related_name="potomci_set",
|
||||
null = True,
|
||||
blank = False,
|
||||
on_delete = models.SET_NULL, # Vrcholy s null kořenem jsou sirotci bez ročníku
|
||||
verbose_name="kořen stromu")
|
||||
first_child = models.ForeignKey('self',
|
||||
first_child = models.ForeignKey('TreeNode',
|
||||
null = True,
|
||||
blank = True,
|
||||
on_delete=models.SET_NULL,
|
||||
verbose_name="první potomek")
|
||||
succ = models.OneToOneField('self',
|
||||
succ = models.OneToOneField('TreeNode',
|
||||
related_name="prev",
|
||||
null = True,
|
||||
blank = True,
|
||||
|
|
Loading…
Reference in a new issue