Pavel Turinský
7 months ago
45 changed files with 884 additions and 71 deletions
@ -0,0 +1,13 @@ |
|||||
|
# Generated by Django 4.2.8 on 2024-03-12 20:24 |
||||
|
|
||||
|
from django.db import migrations |
||||
|
|
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
|
||||
|
dependencies = [ |
||||
|
('korektury', '0020_lepsi_popis_nazvu_PDF_v_adminu'), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
] |
@ -0,0 +1,30 @@ |
|||||
|
# Generated by Django 4.2.11 on 2024-03-19 21:35 |
||||
|
|
||||
|
from django.db import migrations, models |
||||
|
import django.db.models.deletion |
||||
|
|
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
|
||||
|
dependencies = [ |
||||
|
('personalni', '0003_initial'), |
||||
|
('korektury', '0021_auto_20240312_2124'), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
migrations.AlterField( |
||||
|
model_name='komentar', |
||||
|
name='autor', |
||||
|
field=models.ForeignKey(blank=True, help_text='Autor komentáře', null=True, on_delete=django.db.models.deletion.SET_NULL, to='personalni.organizator'), |
||||
|
), |
||||
|
migrations.AlterField( |
||||
|
model_name='korekturovanepdf', |
||||
|
name='org', |
||||
|
field=models.ForeignKey(blank=True, default=None, help_text='Zodpovědný organizátor za obsah', null=True, on_delete=django.db.models.deletion.SET_NULL, to='personalni.organizator'), |
||||
|
), |
||||
|
migrations.AlterField( |
||||
|
model_name='oprava', |
||||
|
name='autor', |
||||
|
field=models.ForeignKey(blank=True, help_text='Autor opravy', null=True, on_delete=django.db.models.deletion.SET_NULL, to='personalni.organizator'), |
||||
|
), |
||||
|
] |
@ -0,0 +1,14 @@ |
|||||
|
# Generated by Django 4.2.11 on 2024-03-26 21:25 |
||||
|
|
||||
|
from django.db import migrations |
||||
|
|
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
|
||||
|
dependencies = [ |
||||
|
('korektury', '0022_alter_komentar_autor_alter_korekturovanepdf_org_and_more'), |
||||
|
('personalni', '0005_personalni_post_migrate'), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
] |
@ -0,0 +1,13 @@ |
|||||
|
# Generated by Django 4.2.8 on 2024-03-12 20:18 |
||||
|
|
||||
|
from django.db import migrations |
||||
|
|
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
|
||||
|
dependencies = [ |
||||
|
('personalni', '0001_skupiny'), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
] |
@ -0,0 +1,146 @@ |
|||||
|
# Generated by Django 4.2.8 on 2024-03-12 21:10 |
||||
|
|
||||
|
from django.db import migrations, models |
||||
|
import django.utils.timezone |
||||
|
import django_countries.fields |
||||
|
import imagekit.models.fields |
||||
|
|
||||
|
from django.conf import settings |
||||
|
import django.db.models.deletion |
||||
|
|
||||
|
def nastav_nove_contenttypes(apps, schema_editor): |
||||
|
ContentType = apps.get_model('contenttypes', 'ContentType') |
||||
|
for m in ('resitel', 'organizator', 'osoba', 'skola', 'prijemce'): |
||||
|
oct = ContentType.objects.filter(app_label='seminar', model=m) |
||||
|
oct.update(app_label='personalni') |
||||
|
|
||||
|
def nastav_stare_contenttypes(apps, schema_editor): |
||||
|
ContentType = apps.get_model('contenttypes', 'ContentType') |
||||
|
for m in ('resitel', 'organizator', 'osoba', 'skola', 'prijemce'): |
||||
|
nct = ContentType.objects.filter(app_label='personalni', model=m) |
||||
|
nct.update(app_label='seminar') |
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
|
||||
|
initial = True |
||||
|
|
||||
|
dependencies = [ |
||||
|
('personalni', '0002_auto_20240312_2118'), |
||||
|
('seminar', '0118_alter_organizator_options_alter_osoba_options_and_more'), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
migrations.RunPython(nastav_nove_contenttypes, nastav_stare_contenttypes), |
||||
|
migrations.CreateModel( |
||||
|
name='Organizator', |
||||
|
fields=[ |
||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
||||
|
('vytvoreno', models.DateTimeField(blank=True, default=django.utils.timezone.now, editable=False, verbose_name='Vytvořeno')), |
||||
|
('organizuje_od', models.DateTimeField(blank=True, null=True, verbose_name='Organizuje od')), |
||||
|
('organizuje_do', models.DateTimeField(blank=True, null=True, verbose_name='Organizuje do')), |
||||
|
('studuje', models.CharField(blank=True, help_text="Např. 'Studuje Obecnou fyziku (Bc.), 3. ročník', 'Vystudovala Diskrétní modely a algoritmy (Mgr.)' nebo 'Přednáší na MFF'", max_length=256, null=True, verbose_name='Studium aj.')), |
||||
|
('strucny_popis_organizatora', models.TextField(blank=True, null=True, verbose_name='Stručný popis organizátora')), |
||||
|
('skola', models.CharField(blank=True, help_text='Škola, např. MFF, VŠCHT, VUT, ... prostě aby se nemuselo psát do studuješkolu, ale jen obor, možnost zobrazit zvlášť', max_length=256, null=True, verbose_name='Škola, kterou studuje')), |
||||
|
('osoba', models.OneToOneField(help_text='osobní údaje organizátora', on_delete=django.db.models.deletion.PROTECT, related_name='org', to='personalni.osoba', verbose_name='osoba')), |
||||
|
], |
||||
|
options={ |
||||
|
'verbose_name': 'Organizátor', |
||||
|
'verbose_name_plural': 'Organizátoři', |
||||
|
'db_table': 'seminar_organizator', |
||||
|
'ordering': ['-organizuje_do', 'osoba__jmeno', 'osoba__prijmeni'], |
||||
|
'managed': False, |
||||
|
}, |
||||
|
), |
||||
|
migrations.CreateModel( |
||||
|
name='Osoba', |
||||
|
fields=[ |
||||
|
('id', models.AutoField(primary_key=True, serialize=False)), |
||||
|
('jmeno', models.CharField(max_length=256, verbose_name='jméno')), |
||||
|
('prijmeni', models.CharField(max_length=256, verbose_name='příjmení')), |
||||
|
('prezdivka', models.CharField(blank=True, max_length=256, null=True, verbose_name='přezdívka')), |
||||
|
('pohlavi_muz', models.BooleanField(default=False, verbose_name='pohlaví (muž)')), |
||||
|
('email', models.EmailField(blank=True, default='', max_length=256, verbose_name='e-mail')), |
||||
|
('telefon', models.CharField(blank=True, default='', max_length=256, verbose_name='telefon')), |
||||
|
('datum_narozeni', models.DateField(blank=True, null=True, verbose_name='datum narození')), |
||||
|
('datum_souhlasu_udaje', models.DateField(blank=True, help_text='Datum souhlasu se zpracováním osobních údajů', null=True, verbose_name='datum souhlasu (údaje)')), |
||||
|
('datum_souhlasu_zasilani', models.DateField(blank=True, help_text='Datum souhlasu se zasíláním MFF materiálů', null=True, verbose_name='datum souhlasu (spam)')), |
||||
|
('datum_registrace', models.DateField(default=django.utils.timezone.now, verbose_name='datum registrace do semináře')), |
||||
|
('ulice', models.CharField(blank=True, default='', max_length=256, verbose_name='ulice')), |
||||
|
('mesto', models.CharField(blank=True, default='', max_length=256, verbose_name='město')), |
||||
|
('psc', models.CharField(blank=True, default='', max_length=32, verbose_name='PSČ')), |
||||
|
('stat', django_countries.fields.CountryField(default='CZ', help_text='ISO 3166-1 kód země velkými písmeny (CZ, SK, ...)', max_length=2, verbose_name='stát')), |
||||
|
('jak_se_dozvedeli', models.TextField(blank=True, verbose_name='Jak se dozvěděli')), |
||||
|
('poznamka', models.TextField(blank=True, help_text='Neveřejná poznámka k osobě (plain text)', verbose_name='neveřejná poznámka')), |
||||
|
('foto', imagekit.models.fields.ProcessedImageField(blank=True, help_text='Vlož fotografii osoby o libovolné velikosti', null=True, upload_to='image_osoby/velke/%Y/', verbose_name='Fotografie osoby')), |
||||
|
('user', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, to=settings.AUTH_USER_MODEL, verbose_name='uživatel')), |
||||
|
], |
||||
|
options={ |
||||
|
'verbose_name': 'Osoba', |
||||
|
'verbose_name_plural': 'Osoby', |
||||
|
'db_table': 'seminar_osoby', |
||||
|
'ordering': ['prijmeni', 'jmeno'], |
||||
|
'managed': False, |
||||
|
}, |
||||
|
), |
||||
|
migrations.CreateModel( |
||||
|
name='Prijemce', |
||||
|
fields=[ |
||||
|
('id', models.AutoField(primary_key=True, serialize=False)), |
||||
|
('poznamka', models.TextField(blank=True, help_text='Neveřejná poznámka k příemci čísel (plain text)', verbose_name='neveřejná poznámka')), |
||||
|
('zasilat_cislo_emailem', models.BooleanField(default=False, help_text='True pokud chce příjemce dostávat číslo emailem', verbose_name='zasílat číslo emailem')), |
||||
|
('osoba', models.OneToOneField(help_text='Které osobě či na jakou adresu se mají zasílat čísla', on_delete=django.db.models.deletion.CASCADE, to='personalni.osoba', verbose_name='komu')), |
||||
|
], |
||||
|
options={ |
||||
|
'verbose_name': 'příjemce', |
||||
|
'verbose_name_plural': 'příjemce', |
||||
|
'db_table': 'seminar_prijemce', |
||||
|
'managed': False, |
||||
|
}, |
||||
|
), |
||||
|
migrations.CreateModel( |
||||
|
name='Resitel', |
||||
|
fields=[ |
||||
|
('id', models.AutoField(primary_key=True, serialize=False)), |
||||
|
('prezdivka_resitele', models.CharField(blank=True, max_length=256, null=True, unique=True, verbose_name='přezdívka řešitele')), |
||||
|
('rok_maturity', models.IntegerField(blank=True, null=True, verbose_name='rok maturity')), |
||||
|
('zasilat', models.CharField(choices=[('domu', 'Domů'), ('do_skoly', 'Do školy'), ('nikam', 'Nezasílat papírově')], default='domu', max_length=32, verbose_name='kam zasílat')), |
||||
|
('zasilat_cislo_emailem', models.BooleanField(default=False, help_text='True pokud chce řešitel dostávat číslo emailem', verbose_name='zasílat číslo emailem')), |
||||
|
('zasilat_cislo_papirove', models.BooleanField(default=True, help_text='True pokud chce řešitel dostávat číslo papírově', verbose_name='zasílat číslo papírově')), |
||||
|
('poznamka', models.TextField(blank=True, help_text='Neveřejná poznámka k řešiteli (plain text)', verbose_name='neveřejná poznámka')), |
||||
|
('osoba', models.OneToOneField(on_delete=django.db.models.deletion.PROTECT, to='personalni.osoba', verbose_name='osoba')), |
||||
|
('skola', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='personalni.skola', verbose_name='škola')), |
||||
|
], |
||||
|
options={ |
||||
|
'verbose_name': 'Řešitel', |
||||
|
'verbose_name_plural': 'Řešitelé', |
||||
|
'db_table': 'seminar_resitele', |
||||
|
'ordering': ['osoba'], |
||||
|
'managed': False, |
||||
|
}, |
||||
|
), |
||||
|
migrations.CreateModel( |
||||
|
name='Skola', |
||||
|
fields=[ |
||||
|
('id', models.AutoField(primary_key=True, serialize=False)), |
||||
|
('aesop_id', models.CharField(blank=True, default='', help_text='Aesopi ID typu "izo:..." nebo "aesop:..."', max_length=32, verbose_name='Aesop ID')), |
||||
|
('izo', models.CharField(blank=True, help_text='IZO školy (jen české školy)', max_length=32, verbose_name='IZO')), |
||||
|
('nazev', models.CharField(help_text='Celý název školy', max_length=256, verbose_name='název')), |
||||
|
('kratky_nazev', models.CharField(blank=True, help_text='Zkrácený název pro zobrazení ve výsledkovce', max_length=256, verbose_name='zkrácený název')), |
||||
|
('ulice', models.CharField(max_length=256, verbose_name='ulice')), |
||||
|
('mesto', models.CharField(max_length=256, verbose_name='město')), |
||||
|
('psc', models.CharField(max_length=32, verbose_name='PSČ')), |
||||
|
('stat', django_countries.fields.CountryField(default='CZ', help_text='ISO 3166-1 kód země velkými písmeny (CZ, SK, ...)', max_length=2, verbose_name='stát')), |
||||
|
('je_zs', models.BooleanField(default=True, verbose_name='základní stupeň')), |
||||
|
('je_ss', models.BooleanField(default=True, verbose_name='střední stupeň')), |
||||
|
('poznamka', models.TextField(blank=True, help_text='Neveřejná poznámka ke škole (plain text)', verbose_name='neveřejná poznámka')), |
||||
|
('kontaktni_osoba', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='personalni.osoba', verbose_name='Kontaktní osoba')), |
||||
|
], |
||||
|
options={ |
||||
|
'verbose_name': 'Škola', |
||||
|
'verbose_name_plural': 'Školy', |
||||
|
'db_table': 'seminar_skoly', |
||||
|
'ordering': ['mesto', 'nazev'], |
||||
|
'managed': False, |
||||
|
}, |
||||
|
), |
||||
|
] |
@ -0,0 +1,34 @@ |
|||||
|
# Generated by Django 4.2.11 on 2024-03-26 21:11 |
||||
|
|
||||
|
from django.db import migrations |
||||
|
|
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
|
||||
|
dependencies = [ |
||||
|
('personalni', '0003_initial'), |
||||
|
('seminar', '0120_remove_osoba_user_remove_prijemce_osoba_and_more'), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
migrations.AlterModelOptions( |
||||
|
name='organizator', |
||||
|
options={'ordering': ['-organizuje_do', 'osoba__jmeno', 'osoba__prijmeni'], 'verbose_name': 'Organizátor', 'verbose_name_plural': 'Organizátoři'}, |
||||
|
), |
||||
|
migrations.AlterModelOptions( |
||||
|
name='osoba', |
||||
|
options={'ordering': ['prijmeni', 'jmeno'], 'verbose_name': 'Osoba', 'verbose_name_plural': 'Osoby'}, |
||||
|
), |
||||
|
migrations.AlterModelOptions( |
||||
|
name='prijemce', |
||||
|
options={'verbose_name': 'příjemce', 'verbose_name_plural': 'příjemce'}, |
||||
|
), |
||||
|
migrations.AlterModelOptions( |
||||
|
name='resitel', |
||||
|
options={'ordering': ['osoba'], 'verbose_name': 'Řešitel', 'verbose_name_plural': 'Řešitelé'}, |
||||
|
), |
||||
|
migrations.AlterModelOptions( |
||||
|
name='skola', |
||||
|
options={'ordering': ['mesto', 'nazev'], 'verbose_name': 'Škola', 'verbose_name_plural': 'Školy'}, |
||||
|
), |
||||
|
] |
@ -0,0 +1,13 @@ |
|||||
|
# Generated by Django 4.2.11 on 2024-03-26 21:25 |
||||
|
|
||||
|
from django.db import migrations |
||||
|
|
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
|
||||
|
dependencies = [ |
||||
|
('personalni', '0004_alter_organizator_options_alter_osoba_options_and_more'), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
] |
@ -0,0 +1,13 @@ |
|||||
|
# Generated by Django 4.2.8 on 2024-03-12 20:24 |
||||
|
|
||||
|
from django.db import migrations |
||||
|
|
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
|
||||
|
dependencies = [ |
||||
|
('prednasky', '0012_auto_20190610_2358'), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
] |
@ -0,0 +1,20 @@ |
|||||
|
# Generated by Django 4.2.11 on 2024-03-19 21:35 |
||||
|
|
||||
|
from django.db import migrations, models |
||||
|
import django.db.models.deletion |
||||
|
|
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
|
||||
|
dependencies = [ |
||||
|
('personalni', '0003_initial'), |
||||
|
('prednasky', '0013_auto_20240312_2124'), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
migrations.AlterField( |
||||
|
model_name='prednaska', |
||||
|
name='org', |
||||
|
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='personalni.organizator'), |
||||
|
), |
||||
|
] |
@ -0,0 +1,14 @@ |
|||||
|
# Generated by Django 4.2.11 on 2024-03-26 21:25 |
||||
|
|
||||
|
from django.db import migrations |
||||
|
|
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
|
||||
|
dependencies = [ |
||||
|
('prednasky', '0014_alter_prednaska_org'), |
||||
|
('personalni', '0005_personalni_post_migrate'), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
] |
@ -0,0 +1,17 @@ |
|||||
|
# Generated by Django 3.2.23 on 2023-12-11 19:14 |
||||
|
|
||||
|
from django.db import migrations |
||||
|
|
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
|
||||
|
dependencies = [ |
||||
|
('seminar', '0114_related_name_se_zmenilo_a_django_chce_migraci_tak_dostane_migraci'), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
migrations.AlterModelOptions( |
||||
|
name='nastaveni', |
||||
|
options={'managed': False, 'verbose_name': 'Nastavení semináře'}, |
||||
|
), |
||||
|
] |
@ -0,0 +1,17 @@ |
|||||
|
# Generated by Django 3.2.23 on 2023-12-11 19:25 |
||||
|
|
||||
|
from django.db import migrations |
||||
|
|
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
|
||||
|
dependencies = [ |
||||
|
('seminar', '0115_alter_nastaveni_options'), |
||||
|
('various', '0001_initial'), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
migrations.DeleteModel( |
||||
|
name='Nastaveni', |
||||
|
), |
||||
|
] |
@ -0,0 +1,16 @@ |
|||||
|
# Generated by Django 4.2.8 on 2024-03-12 20:25 |
||||
|
|
||||
|
from django.db import migrations |
||||
|
|
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
|
||||
|
dependencies = [ |
||||
|
('seminar', '0116_delete_nastaveni'), |
||||
|
('personalni', '0001_skupiny'), |
||||
|
('korektury', '0021_auto_20240312_2124'), |
||||
|
('sifrovacka', '0004_auto_20240312_2124'), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
] |
@ -0,0 +1,33 @@ |
|||||
|
# Generated by Django 4.2.8 on 2024-03-12 20:44 |
||||
|
|
||||
|
from django.db import migrations |
||||
|
|
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
|
||||
|
dependencies = [ |
||||
|
('seminar', '0117_auto_20240312_2125'), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
migrations.AlterModelOptions( |
||||
|
name='organizator', |
||||
|
options={'managed': False, 'ordering': ['-organizuje_do', 'osoba__jmeno', 'osoba__prijmeni'], 'verbose_name': 'Organizátor', 'verbose_name_plural': 'Organizátoři'}, |
||||
|
), |
||||
|
migrations.AlterModelOptions( |
||||
|
name='osoba', |
||||
|
options={'managed': False, 'ordering': ['prijmeni', 'jmeno'], 'verbose_name': 'Osoba', 'verbose_name_plural': 'Osoby'}, |
||||
|
), |
||||
|
migrations.AlterModelOptions( |
||||
|
name='prijemce', |
||||
|
options={'managed': False, 'verbose_name': 'příjemce', 'verbose_name_plural': 'příjemce'}, |
||||
|
), |
||||
|
migrations.AlterModelOptions( |
||||
|
name='resitel', |
||||
|
options={'managed': False, 'ordering': ['osoba'], 'verbose_name': 'Řešitel', 'verbose_name_plural': 'Řešitelé'}, |
||||
|
), |
||||
|
migrations.AlterModelOptions( |
||||
|
name='skola', |
||||
|
options={'managed': False, 'ordering': ['mesto', 'nazev'], 'verbose_name': 'Škola', 'verbose_name_plural': 'Školy'}, |
||||
|
), |
||||
|
] |
@ -0,0 +1,85 @@ |
|||||
|
# Generated by Django 4.2.11 on 2024-03-19 21:35 |
||||
|
|
||||
|
from django.db import migrations, models |
||||
|
import django.db.models.deletion |
||||
|
|
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
|
||||
|
dependencies = [ |
||||
|
('personalni', '0003_initial'), |
||||
|
('seminar', '0118_alter_organizator_options_alter_osoba_options_and_more'), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
migrations.AlterField( |
||||
|
model_name='konfera', |
||||
|
name='ucastnici', |
||||
|
field=models.ManyToManyField(help_text='Seznam účastníků konfery', through='seminar.Konfery_Ucastnici', to='personalni.resitel', verbose_name='účastníci konfery'), |
||||
|
), |
||||
|
migrations.AlterField( |
||||
|
model_name='konfery_ucastnici', |
||||
|
name='resitel', |
||||
|
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='personalni.resitel', verbose_name='řešitel'), |
||||
|
), |
||||
|
migrations.AlterField( |
||||
|
model_name='novinky', |
||||
|
name='autor', |
||||
|
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='personalni.organizator', verbose_name='Autor novinky'), |
||||
|
), |
||||
|
migrations.AlterField( |
||||
|
model_name='orgtextnode', |
||||
|
name='organizator', |
||||
|
field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='personalni.organizator', verbose_name='Organizátor'), |
||||
|
), |
||||
|
migrations.AlterField( |
||||
|
model_name='pohadka', |
||||
|
name='autor', |
||||
|
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='personalni.organizator', verbose_name='Autor pohádky'), |
||||
|
), |
||||
|
migrations.AlterField( |
||||
|
model_name='problem', |
||||
|
name='autor', |
||||
|
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='autor_problemu_%(class)s', to='personalni.organizator', verbose_name='autor problému'), |
||||
|
), |
||||
|
migrations.AlterField( |
||||
|
model_name='problem', |
||||
|
name='garant', |
||||
|
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='garant_problemu_%(class)s', to='personalni.organizator', verbose_name='garant zadaného problému'), |
||||
|
), |
||||
|
migrations.AlterField( |
||||
|
model_name='problem', |
||||
|
name='opravovatele', |
||||
|
field=models.ManyToManyField(blank=True, related_name='opravovatele_%(class)s', to='personalni.organizator', verbose_name='opravovatelé'), |
||||
|
), |
||||
|
migrations.AlterField( |
||||
|
model_name='reseni', |
||||
|
name='resitele', |
||||
|
field=models.ManyToManyField(help_text='Seznam autorů řešení', through='seminar.Reseni_Resitele', to='personalni.resitel', verbose_name='autoři řešení'), |
||||
|
), |
||||
|
migrations.AlterField( |
||||
|
model_name='reseni_resitele', |
||||
|
name='resitele', |
||||
|
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='personalni.resitel', verbose_name='řešitel'), |
||||
|
), |
||||
|
migrations.AlterField( |
||||
|
model_name='soustredeni', |
||||
|
name='organizatori', |
||||
|
field=models.ManyToManyField(help_text='Seznam organizátorů soustředění', through='seminar.Soustredeni_Organizatori', to='personalni.organizator', verbose_name='Organizátoři soustředění'), |
||||
|
), |
||||
|
migrations.AlterField( |
||||
|
model_name='soustredeni', |
||||
|
name='ucastnici', |
||||
|
field=models.ManyToManyField(help_text='Seznam účastníků soustředění', through='seminar.Soustredeni_Ucastnici', to='personalni.resitel', verbose_name='účastníci soustředění'), |
||||
|
), |
||||
|
migrations.AlterField( |
||||
|
model_name='soustredeni_organizatori', |
||||
|
name='organizator', |
||||
|
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='personalni.organizator', verbose_name='organizátor'), |
||||
|
), |
||||
|
migrations.AlterField( |
||||
|
model_name='soustredeni_ucastnici', |
||||
|
name='resitel', |
||||
|
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='personalni.resitel', verbose_name='řešitel'), |
||||
|
), |
||||
|
] |
@ -0,0 +1,52 @@ |
|||||
|
# Generated by Django 4.2.11 on 2024-03-19 21:57 |
||||
|
|
||||
|
from django.db import migrations |
||||
|
|
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
|
||||
|
dependencies = [ |
||||
|
('seminar', '0119_alter_konfera_ucastnici_and_more'), |
||||
|
('personalni', '0003_initial'), |
||||
|
('korektury', '0022_alter_komentar_autor_alter_korekturovanepdf_org_and_more'), |
||||
|
('prednasky', '0014_alter_prednaska_org'), |
||||
|
('sifrovacka', '0005_alter_odpoveducastnika_resitel'), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
migrations.RemoveField( |
||||
|
model_name='osoba', |
||||
|
name='user', |
||||
|
), |
||||
|
migrations.RemoveField( |
||||
|
model_name='prijemce', |
||||
|
name='osoba', |
||||
|
), |
||||
|
migrations.RemoveField( |
||||
|
model_name='resitel', |
||||
|
name='osoba', |
||||
|
), |
||||
|
migrations.RemoveField( |
||||
|
model_name='resitel', |
||||
|
name='skola', |
||||
|
), |
||||
|
migrations.RemoveField( |
||||
|
model_name='skola', |
||||
|
name='kontaktni_osoba', |
||||
|
), |
||||
|
migrations.DeleteModel( |
||||
|
name='Organizator', |
||||
|
), |
||||
|
migrations.DeleteModel( |
||||
|
name='Osoba', |
||||
|
), |
||||
|
migrations.DeleteModel( |
||||
|
name='Prijemce', |
||||
|
), |
||||
|
migrations.DeleteModel( |
||||
|
name='Resitel', |
||||
|
), |
||||
|
migrations.DeleteModel( |
||||
|
name='Skola', |
||||
|
), |
||||
|
] |
@ -0,0 +1,14 @@ |
|||||
|
# Generated by Django 4.2.11 on 2024-03-26 21:25 |
||||
|
|
||||
|
from django.db import migrations |
||||
|
|
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
|
||||
|
dependencies = [ |
||||
|
('seminar', '0120_remove_osoba_user_remove_prijemce_osoba_and_more'), |
||||
|
('personalni', '0005_personalni_post_migrate'), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
] |
@ -1,8 +1,10 @@ |
|||||
from .tvorba import * |
from .tvorba import * |
||||
from .odevzdavatko import * |
from .odevzdavatko import * |
||||
from .base import * |
from .base import * |
||||
from .personalni import * |
|
||||
from .soustredeni import * |
from .soustredeni import * |
||||
from .pomocne import * |
from .pomocne import * |
||||
from .treenode import * |
from .treenode import * |
||||
from .novinky import * |
from .novinky import * |
||||
|
|
||||
|
from various.models import Nastaveni |
||||
|
from personalni.models import Organizator, Resitel, Skola, Prijemce, Osoba |
||||
|
@ -0,0 +1,13 @@ |
|||||
|
# Generated by Django 4.2.8 on 2024-03-12 20:24 |
||||
|
|
||||
|
from django.db import migrations |
||||
|
|
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
|
||||
|
dependencies = [ |
||||
|
('sifrovacka', '0004_napoveda_napovezenoucastnikovi'), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
] |
@ -0,0 +1,25 @@ |
|||||
|
# Generated by Django 4.2.11 on 2024-03-19 21:35 |
||||
|
|
||||
|
from django.db import migrations, models |
||||
|
import django.db.models.deletion |
||||
|
|
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
|
||||
|
dependencies = [ |
||||
|
('personalni', '0003_initial'), |
||||
|
('sifrovacka', '0004_auto_20240312_2124'), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
migrations.AlterField( |
||||
|
model_name='odpoveducastnika', |
||||
|
name='resitel', |
||||
|
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='personalni.resitel'), |
||||
|
), |
||||
|
migrations.AlterField( |
||||
|
model_name='napovezenoucastnikovi', |
||||
|
name='resitel', |
||||
|
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='personalni.resitel'), |
||||
|
), |
||||
|
] |
@ -0,0 +1,14 @@ |
|||||
|
# Generated by Django 4.2.11 on 2024-03-26 21:25 |
||||
|
|
||||
|
from django.db import migrations |
||||
|
|
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
|
||||
|
dependencies = [ |
||||
|
('sifrovacka', '0005_alter_odpoveducastnika_resitel'), |
||||
|
('personalni', '0005_personalni_post_migrate'), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
] |
@ -0,0 +1,52 @@ |
|||||
|
# Správná migrace vypadá takto: |
||||
|
# Generated by Django 3.2.23 on 2023-12-11 19:19 |
||||
|
|
||||
|
def nastav_nove_contenttypes(apps, schema_editor): |
||||
|
ContentType = apps.get_model('contenttypes', 'ContentType') |
||||
|
old_ct = ContentType.objects.filter(app_label='seminar', model='nastaveni') |
||||
|
# Pozn: tohle může být prázdné (pokud Django nedostalo signál o dokončených migracích, např. při vyrábění databáze z nuly) |
||||
|
# Ale .update to nevadí… |
||||
|
old_ct.update(app_label='various') |
||||
|
|
||||
|
def nastav_stare_contenttypes(apps, schema_editor): |
||||
|
ContentType = apps.get_model('contenttypes', 'ContentType') |
||||
|
new_ct = ContentType.objects.filter(app_label='various', model='nastaveni') |
||||
|
new_ct.update(app_label='seminar') |
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
|
||||
|
initial = True |
||||
|
|
||||
|
dependencies = [ |
||||
|
('seminar', '0115_alter_nastaveni_options'), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
migrations.CreateModel( |
||||
|
name='Nastaveni', |
||||
|
fields=[ |
||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
||||
|
('cena_sous', models.IntegerField(default=1000, verbose_name='Účastnický poplatek za soustředění')), |
||||
|
], |
||||
|
options={ |
||||
|
'verbose_name': 'Nastavení semináře', |
||||
|
'db_table': 'seminar_nastaveni', |
||||
|
'managed': False, |
||||
|
}, |
||||
|
), |
||||
|
migrations.RunPython(nastav_nove_contenttypes, nastav_stare_contenttypes), |
||||
|
] |
||||
|
|
||||
|
|
||||
|
|
||||
|
#Hack: zkrácení |
||||
|
def nastav_nove_contenttypes(apps, schema_editor): |
||||
|
ContentType = apps.get_model('contenttypes', 'ContentType') |
||||
|
for m in ('resitel', 'organizator', 'osoba', 'skola', 'prijemce'): |
||||
|
ContentType.objects.filter(app_label='seminar', model=m).update(app_label='personalni') |
||||
|
|
||||
|
def nastav_stare_contenttypes(apps, schema_editor): |
||||
|
ContentType = apps.get_model('contenttypes', 'ContentType') |
||||
|
for m in ('resitel', 'organizator', 'osoba', 'skola', 'prijemce'): |
||||
|
ContentType.objects.filter(app_label='personalni', model=m).update(app_label='seminar') |
||||
|
|
@ -0,0 +1,6 @@ |
|||||
|
Prostě zkopírovat vedle, s původními (=správnými) related names. |
||||
|
makemigrations |
||||
|
! Doplnit hack kolem content-types (jako první operace při migraci) |
||||
|
! Doplnit ForeignKeys (TODO: jak? Já jsem je ukradl až zpětně…) |
||||
|
doplnit závislost na unmanage |
||||
|
migrate |
@ -0,0 +1,9 @@ |
|||||
|
Prostě to smazat. |
||||
|
makemigrations |
||||
|
Kromě triviální smazání modelů se smažou i jejich vazby, to je snad OK. |
||||
|
(Hypotéza: kvůli konzistenčním kontrolám v DB?) |
||||
|
Doplnit vazby na relinky a vznik nového modelu |
||||
|
migrate |
||||
|
a doufat :-P |
||||
|
|
||||
|
(Pozor: pokud něco (JSON serializace, data/… atp.) má starý identifikátor modelu, tak se to teď rozbije.) |
@ -0,0 +1,6 @@ |
|||||
|
from django.db import migrations |
||||
|
class Migration(migrations.Migration): |
||||
|
dependencies = [ |
||||
|
('APP', 'MIGR'), |
||||
|
] |
||||
|
operations = [] |
@ -0,0 +1,4 @@ |
|||||
|
1. smazat `managed = False` |
||||
|
2. makemigrations |
||||
|
Vazba na delete! |
||||
|
3. migrate |
@ -0,0 +1,2 @@ |
|||||
|
dummy migrace v novém modelu |
||||
|
dummy migrace v semináři a ostatních, závisející na té nové migraci. |
@ -0,0 +1,3 @@ |
|||||
|
for app in whatever I want; do |
||||
|
./manage.py makemigrations --empty $app |
||||
|
vim seminar/migrations/whatever.py # add the other as depends. |
@ -0,0 +1,5 @@ |
|||||
|
Přepsat všechny odkazy v sousedních aplikacích na novou aplikaci |
||||
|
Naincludovat nové modely v seminar.models kvůli views |
||||
|
makemigrations |
||||
|
Zkontrolovat přítomnost závislosti na create! |
||||
|
migrate |
@ -0,0 +1,21 @@ |
|||||
|
vim seminar/models/whatever |
||||
|
Model.Meta.managed = False |
||||
|
Model.field.related_name = Model.related_name + '_old' # až vyrobíme nový objekt, tak nesmí kolidovat. |
||||
|
# related_name se vyhodnocuje za běhu, takže pokud nic nespustíme (celý |
||||
|
# blok migrací spustíme najednou), tak nám nevadí, že v tuhle chvíli nefunguje půlka views ap :-) |
||||
|
Nastavit nějak i všechny další závislostní fieldy (mají defaultní related_name!) |
||||
|
- ManyToManyF, OneToOneF, ForeignKey, … |
||||
|
Nevím proč, ale když nebyly unikátní, tak se to potlouklo:: |
||||
|
seminar.Prijemce.osoba: (fields.E304) Reverse accessor 'Osoba.osoba_old' for 'seminar.Prijemce.osoba' clashes with reverse accessor for 'seminar.Resitel.osoba'. |
||||
|
HINT: Add or change a related_name argument to the definition for 'seminar.Prijemce.osoba' or 'seminar.Resitel.osoba'. |
||||
|
seminar.Prijemce.osoba: (fields.E305) Reverse query name for 'seminar.Prijemce.osoba' clashes with reverse query name for 'seminar.Resitel.osoba'. |
||||
|
HINT: Add or change a related_name argument to the definition for 'seminar.Prijemce.osoba' or 'seminar.Resitel.osoba'. |
||||
|
seminar.Resitel.osoba: (fields.E304) Reverse accessor 'Osoba.osoba_old' for 'seminar.Resitel.osoba' clashes with reverse accessor for 'seminar.Prijemce.osoba'. |
||||
|
HINT: Add or change a related_name argument to the definition for 'seminar.Resitel.osoba' or 'seminar.Prijemce.osoba'. |
||||
|
seminar.Resitel.osoba: (fields.E305) Reverse query name for 'seminar.Resitel.osoba' clashes with reverse query name for 'seminar.Prijemce.osoba'. |
||||
|
HINT: Add or change a related_name argument to the definition for 'seminar.Resitel.osoba' or 'seminar.Prijemce.osoba'. |
||||
|
Snadné řešení: dočasné related names mít unikátní. Stejně to nikoho nezajímá. |
||||
|
!! Zkontrolovat, že všechno má nastavenou db_table (jinak se to potom pokusí vybastlit jméno tabulky podle aplikace…) |
||||
|
|
||||
|
makemigrations, bez úprav |
||||
|
migrate? |
@ -0,0 +1,40 @@ |
|||||
|
# Generated by Django 3.2.23 on 2023-12-11 19:19 |
||||
|
|
||||
|
from django.db import migrations, models |
||||
|
|
||||
|
def nastav_nove_contenttypes(apps, schema_editor): |
||||
|
ContentType = apps.get_model('contenttypes', 'ContentType') |
||||
|
old_ct = ContentType.objects.filter(app_label='seminar', model='nastaveni') |
||||
|
# Pozn: tohle může být prázdné (pokud Django nedostalo signál o dokončených migracích, např. při vyrábění databáze z nuly) |
||||
|
# Ale .update to nevadí… |
||||
|
old_ct.update(app_label='various') |
||||
|
|
||||
|
def nastav_stare_contenttypes(apps, schema_editor): |
||||
|
ContentType = apps.get_model('contenttypes', 'ContentType') |
||||
|
new_ct = ContentType.objects.filter(app_label='various', model='nastaveni') |
||||
|
new_ct.update(app_label='seminar') |
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
|
||||
|
initial = True |
||||
|
|
||||
|
dependencies = [ |
||||
|
('seminar', '0115_alter_nastaveni_options'), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
migrations.CreateModel( |
||||
|
name='Nastaveni', |
||||
|
fields=[ |
||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
||||
|
('cena_sous', models.IntegerField(default=1000, verbose_name='Účastnický poplatek za soustředění')), |
||||
|
('aktualni_cislo', models.ForeignKey(null=True, on_delete=models.deletion.PROTECT, to='seminar.cislo', verbose_name='Aktuální číslo')), |
||||
|
], |
||||
|
options={ |
||||
|
'verbose_name': 'Nastavení semináře', |
||||
|
'db_table': 'seminar_nastaveni', |
||||
|
'managed': False, |
||||
|
}, |
||||
|
), |
||||
|
migrations.RunPython(nastav_nove_contenttypes, nastav_stare_contenttypes), |
||||
|
] |
@ -0,0 +1,18 @@ |
|||||
|
# Generated by Django 3.2.23 on 2023-12-11 19:30 |
||||
|
|
||||
|
from django.db import migrations |
||||
|
|
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
|
||||
|
dependencies = [ |
||||
|
('various', '0001_initial'), |
||||
|
('seminar', '0116_delete_nastaveni'), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
migrations.AlterModelOptions( |
||||
|
name='nastaveni', |
||||
|
options={'verbose_name': 'Nastavení semináře'}, |
||||
|
), |
||||
|
] |
@ -0,0 +1,40 @@ |
|||||
|
# Generated by Django 3.2.23 on 2023-12-11 19:40 |
||||
|
|
||||
|
from django.db import migrations |
||||
|
|
||||
|
def oprav_prava_k_nastaveni(apps, schema_editor): |
||||
|
# Tohle je trošku hnus, nešlo by to snáz? |
||||
|
ContentType = apps.get_model('contenttypes', 'ContentType') |
||||
|
Permission = apps.get_model('auth', 'Permission') |
||||
|
Group = apps.get_model('auth', 'Group') |
||||
|
old_ct = ContentType.objects.get_by_natural_key('seminar', 'nastaveni') |
||||
|
new_ct = ContentType.objects.get_by_natural_key('various', 'nastaveni') |
||||
|
old_perms = Permission.objects.filter(content_type=old_ct) |
||||
|
new_perms = Permission.objects.filter(content_type=new_ct) |
||||
|
for g in Group.objects.filter(permissions__in=old_perms): |
||||
|
old_codenames = Permission.objects.filter(group__in=[g], content_type=old_ct).values('codename') |
||||
|
g.permissions.add(*new_perms.filter(codename__in=old_codenames)) |
||||
|
g.permissions.remove(*old_perms) |
||||
|
|
||||
|
def obnov_prava_k_nastaveni(apps, schema_editor): |
||||
|
ContentType = apps.get_model('contenttypes', 'ContentType') |
||||
|
Permission = apps.get_model('auth', 'Permission') |
||||
|
Group = apps.get_model('auth', 'Group') |
||||
|
old_ct = ContentType.objects.get_by_natural_key('seminar', 'nastaveni') |
||||
|
new_ct = ContentType.objects.get_by_natural_key('various', 'nastaveni') |
||||
|
old_perms = Permission.objects.filter(content_type=old_ct) |
||||
|
new_perms = Permission.objects.filter(content_type=new_ct) |
||||
|
for g in Group.objects.filter(permissions__in=old_perms): |
||||
|
new_codenames = Permission.objects.filter(group__in=[g], content_type=new_ct).values('codename') |
||||
|
g.permissions.add(*old_perms.filter(codename__in=new_codenames)) |
||||
|
g.permissions.remove(*new_perms) |
||||
|
|
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
|
||||
|
dependencies = [ |
||||
|
('various', '0002_alter_nastaveni_options'), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
] |
@ -1,3 +1,39 @@ |
|||||
from django.db import models |
from django.db import models |
||||
|
|
||||
# Create your models here. |
from reversion import revisions as reversion |
||||
|
from solo.models import SingletonModel |
||||
|
|
||||
|
from seminar.models import Cislo |
||||
|
|
||||
|
from django.urls import reverse |
||||
|
|
||||
|
@reversion.register(ignore_duplicates=True) |
||||
|
class Nastaveni(SingletonModel): |
||||
|
|
||||
|
class Meta: |
||||
|
db_table = 'seminar_nastaveni' |
||||
|
verbose_name = 'Nastavení semináře' |
||||
|
|
||||
|
# aktualni_rocnik = models.ForeignKey(Rocnik, verbose_name='aktuální ročník', |
||||
|
# null=False, on_delete=models.PROTECT) |
||||
|
|
||||
|
aktualni_cislo = models.ForeignKey(Cislo, verbose_name='Aktuální číslo', |
||||
|
null=True, blank=False, on_delete=models.PROTECT, |
||||
|
) |
||||
|
|
||||
|
cena_sous = models.IntegerField(null=False, |
||||
|
verbose_name="Účastnický poplatek za soustředění", |
||||
|
default=1000) |
||||
|
|
||||
|
@property |
||||
|
def aktualni_rocnik(self): |
||||
|
return self.aktualni_cislo.rocnik |
||||
|
|
||||
|
def __str__(self): |
||||
|
return 'Nastavení semináře' |
||||
|
|
||||
|
def admin_url(self): |
||||
|
return reverse('admin:seminar_nastaveni_change', args=(self.id, )) |
||||
|
|
||||
|
def verejne(self): |
||||
|
return False |
||||
|
Loading…
Reference in new issue