fixup! Pokus o hack: při výrobě modelu na něj rovnou přesměrujeme původní contenttype.
This commit is contained in:
parent
f41d5587fc
commit
39d618834b
1 changed files with 6 additions and 4 deletions
|
@ -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):
|
||||
|
||||
|
|
Loading…
Reference in a new issue