Oprava migrace kolem pohlaví
This commit is contained in:
parent
8949424f48
commit
bb1fb87665
1 changed files with 3 additions and 3 deletions
|
@ -8,12 +8,12 @@ OSLOVENI_ZENSKE = 'resitelka'
|
||||||
OSLOVENI_ZADNE = ''
|
OSLOVENI_ZADNE = ''
|
||||||
|
|
||||||
def pohlavi_to_osloveni(apps, schema_editor):
|
def pohlavi_to_osloveni(apps, schema_editor):
|
||||||
Osoba = apps.get_model('seminar', 'Osoba')
|
Osoba = apps.get_model('personalni', 'Osoba')
|
||||||
Osoba.objects.filter(pohlavi_muz=True).update(osloveni=OSLOVENI_MUZSKE)
|
Osoba.objects.filter(pohlavi_muz=True).update(osloveni=OSLOVENI_MUZSKE)
|
||||||
Osoba.objects.filter(pohlavi_muz=False).update(osloveni=OSLOVENI_ZENSKE)
|
Osoba.objects.filter(pohlavi_muz=False).update(osloveni=OSLOVENI_ZENSKE)
|
||||||
|
|
||||||
def osloveni_to_pohlavi(apps, schema_editor):
|
def osloveni_to_pohlavi(apps, schema_editor):
|
||||||
Osoba = apps.get_model('seminar', 'Osoba')
|
Osoba = apps.get_model('personalni', 'Osoba')
|
||||||
nebinarni = Osoba.objects.filter(osloveni=OSLOVENI_ZADNE)
|
nebinarni = Osoba.objects.filter(osloveni=OSLOVENI_ZADNE)
|
||||||
if nebinarni.count() > 0:
|
if nebinarni.count() > 0:
|
||||||
raise Exception("Nelze odmigrovat: v databázi jsou nebinární osoby, které starý model nereprezentuje správně.")
|
raise Exception("Nelze odmigrovat: v databázi jsou nebinární osoby, které starý model nereprezentuje správně.")
|
||||||
|
@ -23,7 +23,7 @@ def osloveni_to_pohlavi(apps, schema_editor):
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('seminar', '0114_related_name_se_zmenilo_a_django_chce_migraci_tak_dostane_migraci'),
|
('personalni', '0007_post_split_soustredeni'),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
Loading…
Reference in a new issue