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.
43 lines
1.3 KiB
43 lines
1.3 KiB
# Generated by Django 2.2.24 on 2021-09-16 13:09
|
|
|
|
from django.db import migrations, models
|
|
import django.db.models.deletion
|
|
|
|
|
|
def force_osoby(apps, schema_editor):
|
|
typy_osob = [
|
|
'Resitel',
|
|
'Organizator'
|
|
]
|
|
for typ in typy_osob:
|
|
model = apps.get_model('seminar', typ)
|
|
pocet = model.objects.filter(osoba=None).count()
|
|
if pocet > 0:
|
|
# myslím, že je nejde nijak pořádně identifikovat
|
|
raise ValueError(str(pocet) + " " + typ + "ů nemá osobu")
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
dependencies = [
|
|
('seminar', '0001_squashed_0098_auto_20210906_0305'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.RunPython(force_osoby, migrations.RunPython.noop),
|
|
migrations.AlterField(
|
|
model_name='organizator',
|
|
name='osoba',
|
|
field=models.OneToOneField(
|
|
help_text='osobní údaje organizátora',
|
|
on_delete=django.db.models.deletion.PROTECT,
|
|
related_name='org', to='seminar.Osoba',
|
|
verbose_name='osoba'),
|
|
),
|
|
migrations.AlterField(
|
|
model_name='resitel',
|
|
name='osoba',
|
|
field=models.OneToOneField(
|
|
on_delete=django.db.models.deletion.PROTECT,
|
|
to='seminar.Osoba', verbose_name='osoba'),
|
|
),
|
|
]
|
|
|