Bugfixy v migraci
This commit is contained in:
parent
9374df8c69
commit
d54ff1be76
1 changed files with 2 additions and 1 deletions
|
@ -7,6 +7,7 @@ from django.db import migrations
|
||||||
def spoj_k_organizatorum_osoby(apps, scema_editor):
|
def spoj_k_organizatorum_osoby(apps, scema_editor):
|
||||||
Organizator = apps.get_model('seminar', 'Organizator')
|
Organizator = apps.get_model('seminar', 'Organizator')
|
||||||
Resitel = apps.get_model('seminar', 'Resitel')
|
Resitel = apps.get_model('seminar', 'Resitel')
|
||||||
|
Osoba = apps.get_model('seminar', 'Osoba')
|
||||||
for org in Organizator.objects.all():
|
for org in Organizator.objects.all():
|
||||||
|
|
||||||
# Spárování organizátora s osobou
|
# Spárování organizátora s osobou
|
||||||
|
@ -21,7 +22,6 @@ def spoj_k_organizatorum_osoby(apps, scema_editor):
|
||||||
# Přesun informací z organizátora do jeho osoby
|
# Přesun informací z organizátora do jeho osoby
|
||||||
osoba.prezdivka = org.prezdivka
|
osoba.prezdivka = org.prezdivka
|
||||||
osoba.foto = org.foto
|
osoba.foto = org.foto
|
||||||
osoba.foto_male = org.foto_male
|
|
||||||
|
|
||||||
# Všechno uložit
|
# Všechno uložit
|
||||||
osoba.save()
|
osoba.save()
|
||||||
|
@ -54,6 +54,7 @@ def fix_novinka(apps, schema_editor):
|
||||||
Organizator = apps.get_model('seminar', 'Organizator')
|
Organizator = apps.get_model('seminar', 'Organizator')
|
||||||
for nov in Novinky.objects.all():
|
for nov in Novinky.objects.all():
|
||||||
nov.autor = Organizator.objects.filter(osoba__user=nov.autor_old).first()
|
nov.autor = Organizator.objects.filter(osoba__user=nov.autor_old).first()
|
||||||
|
nov.save()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue