Split Apps: oddělení personálních modelů #43
1 changed files with 12 additions and 0 deletions
|
@ -5,6 +5,17 @@ import django.utils.timezone
|
||||||
import django_countries.fields
|
import django_countries.fields
|
||||||
import imagekit.models.fields
|
import imagekit.models.fields
|
||||||
|
|
||||||
|
def nastav_nove_contenttypes(apps, schema_editor):
|
||||||
|
ContentType = apps.get_model('contenttypes', 'ContentType')
|
||||||
|
for m in ('resitel', 'organizator', 'osoba', 'skola', 'prijemce'):
|
||||||
|
oct = ContentType.objects.filter(app_label='seminar', model=m)
|
||||||
|
oct.update(app_label='personalni')
|
||||||
|
|
||||||
|
def nastav_stare_contenttypes(apps, schema_editor):
|
||||||
|
ContentType = apps.get_model('contenttypes', 'ContentType')
|
||||||
|
for m in ('resitel', 'organizator', 'osoba', 'skola', 'prijemce'):
|
||||||
|
nct = ContentType.objects.filter(app_label='personalni', model=m)
|
||||||
|
nct.update(app_label='seminar')
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
@ -16,6 +27,7 @@ class Migration(migrations.Migration):
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
migrations.RunPython(nastav_nove_contenttypes, nastav_stare_contenttypes),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='Organizator',
|
name='Organizator',
|
||||||
fields=[
|
fields=[
|
||||||
|
|
Loading…
Reference in a new issue