103 lines
3.7 KiB

# Generated by Django 2.2.12 on 2020-04-01 20:54
# Fixed by Pavel, 2020-01-04 20:56 UTC
# This is quite possibly a bug in Django.
from django.db import migrations, models
import django.db.models.deletion
def vyrob_dummy_problemy(apps, schema_editor):
Problem = apps.get_model('seminar', 'Problem')
Konfera = apps.get_model('seminar', 'Konfera')
for k in Konfera.objects.all():
pr = Problem.objects.create(nazev=k.nazev,
garant=k.organizator)
pr.save()
k.problem_ptr = pr
k.save()
class Migration(migrations.Migration):
dependencies = [
('contenttypes', '0002_remove_content_type_name'),
('seminar', '0079_clanek_resitelsky'),
]
operations = [
migrations.DeleteModel(
name='Konfery_Ucastnici',
),
migrations.RemoveField(
model_name='konfera',
name='ucastnici',
),
migrations.RemoveField(
model_name='konfera',
name='id',
),
migrations.RemoveField(
model_name='clanek',
name='cislo',
),
migrations.RemoveField(
model_name='clanek',
name='resitelsky',
),
migrations.RemoveField(
model_name='reseni',
name='text_zkraceny',
),
migrations.DeleteModel( # nejdříve musím smazat objekt ukazující na konferu,
name='KonferaNode', # pak až změnit klíč konferám (viz další operace)
),
migrations.AddField(
model_name='konfera',
name='problem_ptr',
field=models.OneToOneField(auto_created=True, null=False, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='seminar.Problem'),
preserve_default=False,
),
migrations.RemoveField(
model_name='konfera',
name='nazev',
),
migrations.RemoveField(
model_name='konfera',
name='organizator',
),
migrations.RemoveField(
model_name='konfera',
name='poznamka',
),
migrations.RemoveField(
model_name='konfera',
name='reseni',
),
migrations.AlterField(
model_name='reseni',
name='text_cely',
field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='reseni_cely_set', to='seminar.ReseniNode', verbose_name='Plná verze textu řešení'),
),
migrations.DeleteModel(
name='ClanekNode',
),
migrations.CreateModel(
name='Konfery_Ucastnici',
fields=[
('id', models.AutoField(primary_key=True, serialize=False)),
('poznamka', models.TextField(blank=True, help_text='Neveřejná poznámka k účasti (plain text)', verbose_name='neveřejná poznámka')),
('konfera', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='seminar.Konfera', verbose_name='konfera')),
('resitel', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Resitel', verbose_name='řešitel')),
],
options={
'verbose_name': 'Účast na konfeře',
'verbose_name_plural': 'Účasti na konfeře',
'db_table': 'seminar_konfery_ucastnici',
'ordering': ['konfera', 'resitel'],
},
),
migrations.AddField(
model_name='konfera',
name='ucastnici',
field=models.ManyToManyField(help_text='Seznam účastníků konfery', through='seminar.Konfery_Ucastnici', to='seminar.Resitel', verbose_name='účastníci konfery'),
),
]