Browse Source

Pokus o hack: při výrobě modelu na něj rovnou přesměrujeme původní contenttype.

pull/43/head
Pavel 'LEdoian' Turinsky 11 months ago
parent
commit
f41d5587fc
  1. 10
      various/migrations/0001_initial.py
  2. 1
      various/migrations/0003_fix_permissions.py

10
various/migrations/0001_initial.py

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

1
various/migrations/0003_fix_permissions.py

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

Loading…
Cancel
Save