Compare commits

...

2 commits

2 changed files with 12 additions and 1 deletions

View file

@ -2,6 +2,17 @@
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):
@ -24,4 +35,5 @@ class Migration(migrations.Migration):
'managed': False,
},
),
migrations.RunPython(nastav_nove_contenttypes, nastav_stare_contenttypes),
]

View file

@ -37,5 +37,4 @@ class Migration(migrations.Migration):
]
operations = [
migrations.RunPython(oprav_prava_k_nastaveni, obnov_prava_k_nastaveni),
]