Web M&M
https://mam.matfyz.cz
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
231 lines
13 KiB
231 lines
13 KiB
# Generated by Django 4.2.16 on 2024-11-02 20:06
|
|
|
|
from django.db import migrations, models
|
|
import django.db.models.deletion
|
|
|
|
def nastav_nove_contenttypes(apps, schema_editor):
|
|
ContentType = apps.get_model('contenttypes', 'ContentType')
|
|
# Seznam níž ověřen tím, že se skutečně při téhle migraci tabulka `django_content_type` (lokální v SQLite) změní správně :-)
|
|
for m in ('ulohavzoraknode', 'ulohazadaninode', 'cislonode', 'temavcislenode', 'orgtextnode', 'obrazek', 'rocniknode', 'pohadkanode', 'textnode', 'mezicislonode', 'reseninode', 'castnode', 'text', 'treenode'):
|
|
ContentType.objects.filter(app_label='seminar', model=m).update(app_label='treenode')
|
|
|
|
def nastav_stare_contenttypes(apps, schema_editor):
|
|
ContentType = apps.get_model('contenttypes', 'ContentType')
|
|
for m in ('ulohavzoraknode', 'ulohazadaninode', 'cislonode', 'temavcislenode', 'orgtextnode', 'obrazek', 'rocniknode', 'pohadkanode', 'textnode', 'mezicislonode', 'reseninode', 'castnode', 'text', 'treenode'):
|
|
ContentType.objects.filter(app_label='treenode', model=m).update(app_label='seminar')
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
initial = True
|
|
|
|
dependencies = [
|
|
('seminar', '0141_odstrel_treenode_unmanage'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name='Obrazek',
|
|
fields=[
|
|
('id', models.AutoField(primary_key=True, serialize=False)),
|
|
('na_web', models.ImageField(blank=True, null=True, upload_to='obrazky/%Y/%m/%d/', verbose_name='obrázek na web')),
|
|
('do_cisla_barevny', models.FileField(blank=True, help_text='Barevná verze obrázku do čísla', null=True, upload_to='obrazky/%Y/%m/%d/', verbose_name='barevný obrázek do čísla')),
|
|
('do_cisla_cernobily', models.FileField(blank=True, help_text='Černobílá verze obrázku do čísla', null=True, upload_to='obrazky/%Y/%m/%d/', verbose_name='černobílý obrázek do čísla')),
|
|
('text', models.ForeignKey(help_text='text, ve kterém se obrázek vyskytuje', on_delete=django.db.models.deletion.CASCADE, to='treenode.text', verbose_name='text')),
|
|
],
|
|
options={
|
|
'verbose_name': 'obrázek',
|
|
'verbose_name_plural': 'obrázky',
|
|
'db_table': 'seminar_obrazky',
|
|
'managed': False,
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name='Text',
|
|
fields=[
|
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('na_web', models.TextField(blank=True, help_text='Text ke zveřejnění na webu', verbose_name='text na web')),
|
|
('do_cisla', models.TextField(blank=True, help_text='Text ke zveřejnění v čísle', verbose_name='text do čísla')),
|
|
],
|
|
options={
|
|
'verbose_name': 'text',
|
|
'verbose_name_plural': 'texty',
|
|
'db_table': 'seminar_texty',
|
|
'managed': False,
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name='TreeNode',
|
|
fields=[
|
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('nazev', models.TextField(help_text='Tento název se zobrazuje v nabídkách pro výběr vhodného TreeNode', null=True, verbose_name='název tohoto node')),
|
|
('zajimave', models.BooleanField(default=False, help_text='Zobrazí se daná věc na rozcestníku témátek', verbose_name='Zajímavé')),
|
|
('srolovatelne', models.BooleanField(blank=True, help_text='Bude na stránce témátka možnost tuto položku skrýt', null=True, verbose_name='Srolovatelné')),
|
|
('first_child', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='father_of_first', to='treenode.treenode', verbose_name='první potomek')),
|
|
('polymorphic_ctype', models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='polymorphic_%(app_label)s.%(class)s_set+', to='contenttypes.contenttype')),
|
|
('root', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='potomci_set', to='treenode.treenode', verbose_name='kořen stromu')),
|
|
('succ', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='prev', to='treenode.treenode', verbose_name='další element na stejné úrovni')),
|
|
],
|
|
options={
|
|
'verbose_name': 'TreeNode',
|
|
'verbose_name_plural': 'TreeNody',
|
|
'db_table': 'seminar_nodes_treenode',
|
|
'managed': False,
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name='CastNode',
|
|
fields=[
|
|
('treenode_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='treenode.treenode')),
|
|
('nadpis', models.CharField(help_text='Nadpis podvěšené části obsahu', max_length=100, verbose_name='Nadpis')),
|
|
],
|
|
options={
|
|
'verbose_name': 'Část (Node)',
|
|
'verbose_name_plural': 'Části (Node)',
|
|
'db_table': 'seminar_nodes_cast',
|
|
'managed': False,
|
|
},
|
|
bases=('treenode.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='treenode.treenode')),
|
|
('cislo', models.OneToOneField(on_delete=django.db.models.deletion.PROTECT, to='tvorba.cislo', verbose_name='číslo')),
|
|
],
|
|
options={
|
|
'verbose_name': 'Číslo (Node)',
|
|
'verbose_name_plural': 'Čísla (Node)',
|
|
'db_table': 'seminar_nodes_cislo',
|
|
'managed': False,
|
|
},
|
|
bases=('treenode.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='treenode.treenode')),
|
|
],
|
|
options={
|
|
'verbose_name': 'Mezičíslo (Node)',
|
|
'verbose_name_plural': 'Mezičísla (Node)',
|
|
'db_table': 'seminar_nodes_mezicislo',
|
|
'managed': False,
|
|
},
|
|
bases=('treenode.treenode',),
|
|
),
|
|
migrations.CreateModel(
|
|
name='OrgTextNode',
|
|
fields=[
|
|
('treenode_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='treenode.treenode')),
|
|
('org_verejny', models.BooleanField(default=True, help_text='Pokud ano, bude org pod článkem podepsaný', verbose_name='Org je veřejný?')),
|
|
('organizator', models.ForeignKey( on_delete=django.db.models.deletion.DO_NOTHING, to='personalni.organizator', verbose_name='Organizátor')),
|
|
],
|
|
options={
|
|
'verbose_name': 'Organizátorský článek (Node)',
|
|
'verbose_name_plural': 'Organizátorské články (Node)',
|
|
'db_table': 'seminar_nodes_orgtextnode',
|
|
'managed': False,
|
|
},
|
|
bases=('treenode.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='treenode.treenode')),
|
|
('pohadka', models.OneToOneField(on_delete=django.db.models.deletion.PROTECT, to='tvorba.pohadka', verbose_name='pohádka')),
|
|
],
|
|
options={
|
|
'verbose_name': 'Pohádka (Node)',
|
|
'verbose_name_plural': 'Pohádky (Node)',
|
|
'db_table': 'seminar_nodes_pohadka',
|
|
'managed': False,
|
|
},
|
|
bases=('treenode.treenode',),
|
|
),
|
|
migrations.CreateModel(
|
|
name='ReseniNode',
|
|
fields=[
|
|
('treenode_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='treenode.treenode')),
|
|
('reseni', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='odevzdavatko.reseni', verbose_name='reseni')),
|
|
],
|
|
options={
|
|
'verbose_name': 'Otištěné řešení (Node)',
|
|
'verbose_name_plural': 'Otištěná řešení (Node)',
|
|
'db_table': 'seminar_nodes_otistene_reseni',
|
|
'managed': False,
|
|
},
|
|
bases=('treenode.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='treenode.treenode')),
|
|
('rocnik', models.OneToOneField(on_delete=django.db.models.deletion.PROTECT, to='tvorba.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',
|
|
'managed': False,
|
|
},
|
|
bases=('treenode.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='treenode.treenode')),
|
|
('tema', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='tvorba.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',
|
|
'managed': False,
|
|
},
|
|
bases=('treenode.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='treenode.treenode')),
|
|
('text', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='treenode.text', verbose_name='text')),
|
|
],
|
|
options={
|
|
'verbose_name': 'Text (Node)',
|
|
'verbose_name_plural': 'Text (Node)',
|
|
'db_table': 'seminar_nodes_obsah',
|
|
'managed': False,
|
|
},
|
|
bases=('treenode.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='treenode.treenode')),
|
|
('uloha', models.OneToOneField(null=True, on_delete=django.db.models.deletion.PROTECT, to='tvorba.uloha', verbose_name='úloha')),
|
|
],
|
|
options={
|
|
'verbose_name': 'Vzorák úlohy (Node)',
|
|
'verbose_name_plural': 'Vzoráky úloh (Node)',
|
|
'db_table': 'seminar_nodes_uloha_vzorak',
|
|
'managed': False,
|
|
},
|
|
bases=('treenode.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='treenode.treenode')),
|
|
('uloha', models.OneToOneField(null=True, on_delete=django.db.models.deletion.PROTECT, to='tvorba.uloha', verbose_name='úloha')),
|
|
],
|
|
options={
|
|
'verbose_name': 'Zadání úlohy (Node)',
|
|
'verbose_name_plural': 'Zadání úloh (Node)',
|
|
'db_table': 'seminar_nodes_uloha_zadani',
|
|
'managed': False,
|
|
},
|
|
bases=('treenode.treenode',),
|
|
),
|
|
migrations.RunPython(nastav_nove_contenttypes, nastav_stare_contenttypes),
|
|
]
|
|
|