Compare commits
2 commits
37586d7433
...
39d618834b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
39d618834b | ||
|
|
f41d5587fc |
2 changed files with 12 additions and 1 deletions
|
|
@ -2,6 +2,17 @@
|
||||||
|
|
||||||
from django.db import migrations, models
|
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):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
|
@ -24,4 +35,5 @@ class Migration(migrations.Migration):
|
||||||
'managed': False,
|
'managed': False,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
migrations.RunPython(nastav_nove_contenttypes, nastav_stare_contenttypes),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -37,5 +37,4 @@ class Migration(migrations.Migration):
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.RunPython(oprav_prava_k_nastaveni, obnov_prava_k_nastaveni),
|
|
||||||
]
|
]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue