Pokus o hack: při výrobě modelu na něj rovnou přesměrujeme původní contenttype.
This commit is contained in:
parent
37586d7433
commit
f41d5587fc
2 changed files with 10 additions and 1 deletions
|
@ -2,6 +2,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')
|
||||
|
||||
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')
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
|
@ -24,4 +33,5 @@ class Migration(migrations.Migration):
|
|||
'managed': False,
|
||||
},
|
||||
),
|
||||
migrations.RunPython(nastav_nove_contenttypes, nastav_stare_contenttypes),
|
||||
]
|
||||
|
|
|
@ -37,5 +37,4 @@ class Migration(migrations.Migration):
|
|||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(oprav_prava_k_nastaveni, obnov_prava_k_nastaveni),
|
||||
]
|
||||
|
|
Loading…
Reference in a new issue