From df682e0630992b63449ffb242a8fbb8894ef1b96 Mon Sep 17 00:00:00 2001 From: "Pavel Turinsky (DebianVM @ Zr)" Date: Wed, 30 Jun 2021 01:01:35 +0000 Subject: [PATCH] Revert "m0060: likvidace sirotku ve stromu" This reverts commit 7f89af129f31e5973ad578b3bcf074c5c305c919. Pushuju blbosti :-) --- db_compare.py | 4 ++-- mamweb/settings_local.py | 14 +++++++------- seminar/migrations/0060_spoj_stromy.py | 12 ++---------- 3 files changed, 11 insertions(+), 19 deletions(-) diff --git a/db_compare.py b/db_compare.py index f960492a..3cdee268 100755 --- a/db_compare.py +++ b/db_compare.py @@ -3,8 +3,8 @@ import psycopg2 import psycopg2.extras -OLD_DB = "mam-prod" -NEW_DB = "mam-test" +OLD_DB = "mam_old" +NEW_DB = "mamweb" oldconn = psycopg2.connect(f"dbname={OLD_DB}") newconn = psycopg2.connect(f"dbname={NEW_DB}") diff --git a/mamweb/settings_local.py b/mamweb/settings_local.py index 2ba43478..0aadd27e 100644 --- a/mamweb/settings_local.py +++ b/mamweb/settings_local.py @@ -39,13 +39,13 @@ DATABASES = { 'NAME': os.path.join(BASE_DIR, 'db-local.sqlite3'), } } -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.postgresql_psycopg2', - 'NAME': 'mam-test', - 'USER': 'kam', - }, -} +#DATABASES = { +# 'default': { +# 'ENGINE': 'django.db.backends.postgresql_psycopg2', +# 'NAME': 'mam_local', +# 'USER': 'mam', +# }, +#} # LOGGING LOGGING = { diff --git a/seminar/migrations/0060_spoj_stromy.py b/seminar/migrations/0060_spoj_stromy.py index d0826ca1..59b2943d 100644 --- a/seminar/migrations/0060_spoj_stromy.py +++ b/seminar/migrations/0060_spoj_stromy.py @@ -6,15 +6,6 @@ from django.db import migrations from django.db.models import Q -def nastav_koren(koren, node): - node.root = koren - node.save() - - if node.succ: - nastav_koren(koren, node.succ) - if node.first_child: - nastav_koren(koren, node.first_child) - def pridej_potomka(rodic, potomek): # Daný vrchol bude posledním potomkem rodiče uz_ma_deti = False @@ -32,7 +23,8 @@ def pridej_potomka(rodic, potomek): posledni = posledni.succ # Nastavíme kořen: - nastav_koren(rodic.root, potomek) + potomek.root = rodic.root + potomek.save() # Připojíme vrchol: if uz_ma_deti: