From 7f93171c39c67c2826e79f6bb55b31e83adda2d4 Mon Sep 17 00:00:00 2001 From: MaM Web user Date: Thu, 2 Sep 2021 16:01:27 +0200 Subject: [PATCH] =?UTF-8?q?Rozbit=C3=A9=20probl=C3=A9my=20vy=C5=99e=C5=A1e?= =?UTF-8?q?ny=20metodou=20=C5=BDAVES?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy_v2/pre_migration.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/deploy_v2/pre_migration.py b/deploy_v2/pre_migration.py index 53f58d95..7501976f 100755 --- a/deploy_v2/pre_migration.py +++ b/deploy_v2/pre_migration.py @@ -17,11 +17,15 @@ from django.db import connection def smaz_zle_clanky(): # Tyhle clanky vubec nejsou clanky, bude potreba je udelat cele jinak a spravne. #m.Problem.objects.filter(id__in=[1981, 1970, 2222]).delete() + ## with connection.cursor() as cursor: + ## # Nejdriv musime smazat reseni: + ## cursor.execute('DELETE FROM seminar_reseni WHERE problem_id IN (1981, 1970, 2222);') + ## # Nakonec i ty clanky samotne + ## cursor.execute('DELETE FROM seminar_problemy WHERE id IN (1981, 1970, 2222);') + + # Update: stejně je v DB bordel, tak z nich prostě jen udělám témata a všechno zhruba přežije… with connection.cursor() as cursor: - # Nejdriv musime smazat reseni: - cursor.execute('DELETE FROM seminar_reseni WHERE problem_id IN (1981, 1970, 2222);') - # Nakonec i ty clanky samotne - cursor.execute('DELETE FROM seminar_problemy WHERE id IN (1981, 1970, 2222);') + cursor.execute("UPDATE seminar_problemy SET typ = 'tema' WHERE id IN (1981, 1970, 2222);") def smaz_divne_uzivatele(): # U techto uzivatelu neexistuje Organizator s nimi spojeny