Revert "m0060: likvidace sirotku ve stromu"
This reverts commit 7f89af129f
.
Pushuju blbosti :-)
This commit is contained in:
parent
7f89af129f
commit
df682e0630
3 changed files with 11 additions and 19 deletions
|
@ -3,8 +3,8 @@
|
||||||
import psycopg2
|
import psycopg2
|
||||||
import psycopg2.extras
|
import psycopg2.extras
|
||||||
|
|
||||||
OLD_DB = "mam-prod"
|
OLD_DB = "mam_old"
|
||||||
NEW_DB = "mam-test"
|
NEW_DB = "mamweb"
|
||||||
|
|
||||||
oldconn = psycopg2.connect(f"dbname={OLD_DB}")
|
oldconn = psycopg2.connect(f"dbname={OLD_DB}")
|
||||||
newconn = psycopg2.connect(f"dbname={NEW_DB}")
|
newconn = psycopg2.connect(f"dbname={NEW_DB}")
|
||||||
|
|
|
@ -39,13 +39,13 @@ DATABASES = {
|
||||||
'NAME': os.path.join(BASE_DIR, 'db-local.sqlite3'),
|
'NAME': os.path.join(BASE_DIR, 'db-local.sqlite3'),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DATABASES = {
|
#DATABASES = {
|
||||||
'default': {
|
# 'default': {
|
||||||
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
# 'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||||
'NAME': 'mam-test',
|
# 'NAME': 'mam_local',
|
||||||
'USER': 'kam',
|
# 'USER': 'mam',
|
||||||
},
|
# },
|
||||||
}
|
#}
|
||||||
|
|
||||||
# LOGGING
|
# LOGGING
|
||||||
LOGGING = {
|
LOGGING = {
|
||||||
|
|
|
@ -6,15 +6,6 @@ from django.db import migrations
|
||||||
|
|
||||||
from django.db.models import Q
|
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):
|
def pridej_potomka(rodic, potomek):
|
||||||
# Daný vrchol bude posledním potomkem rodiče
|
# Daný vrchol bude posledním potomkem rodiče
|
||||||
uz_ma_deti = False
|
uz_ma_deti = False
|
||||||
|
@ -32,7 +23,8 @@ def pridej_potomka(rodic, potomek):
|
||||||
posledni = posledni.succ
|
posledni = posledni.succ
|
||||||
|
|
||||||
# Nastavíme kořen:
|
# Nastavíme kořen:
|
||||||
nastav_koren(rodic.root, potomek)
|
potomek.root = rodic.root
|
||||||
|
potomek.save()
|
||||||
|
|
||||||
# Připojíme vrchol:
|
# Připojíme vrchol:
|
||||||
if uz_ma_deti:
|
if uz_ma_deti:
|
||||||
|
|
Loading…
Reference in a new issue