mamweb/various/migrations/0001_initial.py

41 lines
1.6 KiB
Python
Raw Normal View History

2023-12-11 20:21:27 +01:00
# 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')
2023-12-11 20:21:27 +01:00
class Migration(migrations.Migration):
initial = True
dependencies = [
2023-12-11 20:28:58 +01:00
('seminar', '0115_alter_nastaveni_options'),
2023-12-11 20:21:27 +01:00
]
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í')),
2024-03-19 22:15:29 +01:00
('aktualni_cislo', models.ForeignKey(null=True, on_delete=models.deletion.PROTECT, to='seminar.cislo', verbose_name='Aktuální číslo')),
2023-12-11 20:21:27 +01:00
],
options={
'verbose_name': 'Nastavení semináře',
'db_table': 'seminar_nastaveni',
'managed': False,
},
),
migrations.RunPython(nastav_nove_contenttypes, nastav_stare_contenttypes),
2023-12-11 20:21:27 +01:00
]