|
|
@ -8,12 +8,12 @@ OSLOVENI_ZENSKE = 'resitelka' |
|
|
|
OSLOVENI_ZADNE = '' |
|
|
|
|
|
|
|
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=False).update(osloveni=OSLOVENI_ZENSKE) |
|
|
|
|
|
|
|
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) |
|
|
|
if nebinarni.count() > 0: |
|
|
|
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): |
|
|
|
|
|
|
|
dependencies = [ |
|
|
|
('seminar', '0114_related_name_se_zmenilo_a_django_chce_migraci_tak_dostane_migraci'), |
|
|
|
('personalni', '0007_post_split_soustredeni'), |
|
|
|
] |
|
|
|
|
|
|
|
operations = [ |