Browse Source

Oprava migrace kolem pohlaví

pull/49/head
Pavel "LEdoian" Turinsky 6 months ago
parent
commit
bb1fb87665
  1. 6
      personalni/migrations/0008_reforma_pohlavi.py

6
seminar/migrations/0115_reforma_pohlavi.py → personalni/migrations/0008_reforma_pohlavi.py

@ -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 = [
Loading…
Cancel
Save