Split Apps: oddělení personálních modelů #43

Merged
ledoian merged 48 commits from split-apps into master 2024-04-30 23:48:36 +02:00
Showing only changes of commit 39d618834b - Show all commits

View file

@ -4,13 +4,15 @@ from django.db import migrations, models
def nastav_nove_contenttypes(apps, schema_editor):
ContentType = apps.get_model('contenttypes', 'ContentType')
old_ct = ContentType.objects.get_by_natural_key('seminar', 'nastaveni')
old_ct.update(appname='various')
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.get_by_natural_key('various', 'nastaveni')
new_ct.update(appname='seminar')
new_ct = ContentType.objects.filter(app_label='various', model='nastaveni')
new_ct.update(app_label='seminar')
class Migration(migrations.Migration):