From 23caabba6b49c42a1c44979f1dda9bc92e4f88ec Mon Sep 17 00:00:00 2001 From: Tomas 'Jethro' Pokorny Date: Tue, 8 Jun 2021 22:57:17 +0200 Subject: [PATCH] Bugfixy mighraci --- db_compare.py | 10 ++++++---- ...na_prezdivka.py => 0085_nepovinna_prezdivka.py_old} | 4 +++- seminar/migrations/0086_auto_20200819_0959.py | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) rename seminar/migrations/{0085_nepovinna_prezdivka.py => 0085_nepovinna_prezdivka.py_old} (85%) diff --git a/db_compare.py b/db_compare.py index 413bd948..2d4e9c16 100644 --- a/db_compare.py +++ b/db_compare.py @@ -160,16 +160,18 @@ def check_organizator(): for o,n in res: check_same(o,n,old_fields, new_fields) # organizuje od, do: - print(list(o.keys()),list(n.keys())) - if o['organizuje_od_roku'] != n['organizuje_od'].year: + if o['organizuje_do_roku'] is None and n['organizuje_do'] is None: + pass + elif o['organizuje_od_roku'] != n['organizuje_od'].year: raise ValueError(f'Not matching organizuje_od for org id={o["id"]}: old {o["organizuje_od_roku"]}, new {n["organizuje_od"]}') - if o['organizuje_do_roku'] != n['organizuje_do'].year: + if o['organizuje_do_roku'] is None and n['organizuje_do'] is None: + pass + elif o['organizuje_do_roku'] != n['organizuje_do'].year: raise ValueError(f'Not matching organizuje_do for org id={o["id"]}: old {o["organizuje_do_roku"]}, new {n["organizuje_do"]}') if o['prezdivka'] == n['o_prezdivka']: continue if o['prezdivka'] is None and n['o_prezdivka'] == '': continue - print(o,n) raise ValueError(f'Not matching prezdivka for org id={o["id"]}: old {o["prezdivka"]}, new {n["o_prezdivka"]}') diff --git a/seminar/migrations/0085_nepovinna_prezdivka.py b/seminar/migrations/0085_nepovinna_prezdivka.py_old similarity index 85% rename from seminar/migrations/0085_nepovinna_prezdivka.py rename to seminar/migrations/0085_nepovinna_prezdivka.py_old index b3bd19a4..4a8f02e0 100644 --- a/seminar/migrations/0085_nepovinna_prezdivka.py +++ b/seminar/migrations/0085_nepovinna_prezdivka.py_old @@ -1,5 +1,7 @@ # Generated by Django 2.2.13 on 2020-06-24 22:57 +# V současné době nepoužíván + from django.db import migrations, models def smaz_prezdivku(apps, schema_editor): @@ -26,7 +28,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='osoba', name='prezdivka', - field=models.CharField(blank=True, max_length=256, null=True, verbose_name='přezdívka'), + field=models.CharField(blank=True, max_length=256, verbose_name='přezdívka'), ), migrations.RunPython(smaz_prezdivku, pridej_prezdivku), ] diff --git a/seminar/migrations/0086_auto_20200819_0959.py b/seminar/migrations/0086_auto_20200819_0959.py index a5847e71..7b6b85a3 100644 --- a/seminar/migrations/0086_auto_20200819_0959.py +++ b/seminar/migrations/0086_auto_20200819_0959.py @@ -6,7 +6,7 @@ from django.db import migrations class Migration(migrations.Migration): dependencies = [ - ('seminar', '0085_nepovinna_prezdivka'), + ('seminar', '0084_clanek_cislo'), ] operations = [