LEdoian
6 years ago
2 changed files with 234 additions and 0 deletions
@ -0,0 +1,61 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# Generated by Django 1.11.20 on 2019-05-29 03:26 |
||||
|
from __future__ import unicode_literals |
||||
|
|
||||
|
from django.db import migrations |
||||
|
|
||||
|
def pridej_potomka(rodic, potomek): |
||||
|
# Daný vrchol bude posledním potomkem rodiče |
||||
|
uz_ma_deti = False |
||||
|
posledni = None |
||||
|
|
||||
|
# Najdeme aktuálně posledního potomka: |
||||
|
if rodic.first_child: |
||||
|
uz_ma_deti = True |
||||
|
posledni = rodic.first_child |
||||
|
while posledni.succ: |
||||
|
posledni = posledni.succ |
||||
|
|
||||
|
# Nastavíme kořen: |
||||
|
potomek.root = rodic.root |
||||
|
potomek.save() |
||||
|
|
||||
|
# Připojíme vrchol: |
||||
|
if uz_ma_deti: |
||||
|
posledni.succ = potomek |
||||
|
posledni.save() |
||||
|
else: |
||||
|
rodic.first_child = potomek |
||||
|
rodic.save() |
||||
|
|
||||
|
def pokacej_les(apps, schema_editor): |
||||
|
# Teď je potřeba všechny TreeNody příslušející k zadaným problémům připojit |
||||
|
# do hlavního stromu |
||||
|
# Tohle je jednoduchá verze: nejdřív témátka a seriály, pak úložky a pohádky, |
||||
|
# pak články a konfery, pak vzoráky, všechno setříděné podle kódu (FIXME?) |
||||
|
|
||||
|
# Kopírování je častým zdrojem chyb! |
||||
|
CisloNode = apps.get_model('seminar', 'CisloNode') |
||||
|
TemaVCisleNode = apps.get_model('seminar', 'TemaVCisleNode') |
||||
|
KonferaNode = apps.get_model('seminar', 'KonferaNode') |
||||
|
ClanekNode = apps.get_model('seminar', 'ClanekNode') |
||||
|
UlohaZadaniNode = apps.get_model('seminar', 'UlohaZadaniNode') |
||||
|
UlohaVzorakNode = apps.get_model('seminar', 'UlohaVzorakNode') |
||||
|
Tema = apps.get_model('seminar', 'Tema') |
||||
|
Konfera = apps.get_model('seminar', 'Konfera') |
||||
|
Clanek = apps.get_model('seminar', 'Clanek') |
||||
|
Uloha = apps.get_model('seminar', 'Uloha') |
||||
|
Problem = apps.get_model('seminar', 'Problem') |
||||
|
|
||||
|
#TODO! |
||||
|
raise NotYetImplemented("Ještě než se smaže Franken-model, je potřeba spojit stromečky správně!") |
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
|
||||
|
dependencies = [ |
||||
|
('seminar', '0058_problem_to_uloha_tema_clanek'), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
migrations.RunPython(pokacej_les), |
||||
|
] |
@ -0,0 +1,173 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# Generated by Django 1.11.20 on 2019-05-29 03:29 |
||||
|
from __future__ import unicode_literals |
||||
|
|
||||
|
from django.db import migrations, models |
||||
|
import django.db.models.deletion |
||||
|
import django.utils.timezone |
||||
|
|
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
|
||||
|
dependencies = [ |
||||
|
('seminar', '0059_spoj_stromy'), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
migrations.RemoveField( |
||||
|
model_name='novinky', |
||||
|
name='autor_old', |
||||
|
), |
||||
|
migrations.RemoveField( |
||||
|
model_name='organizator', |
||||
|
name='foto', |
||||
|
), |
||||
|
migrations.RemoveField( |
||||
|
model_name='organizator', |
||||
|
name='organizuje_do_roku', |
||||
|
), |
||||
|
migrations.RemoveField( |
||||
|
model_name='organizator', |
||||
|
name='organizuje_od_roku', |
||||
|
), |
||||
|
migrations.RemoveField( |
||||
|
model_name='organizator', |
||||
|
name='prezdivka', |
||||
|
), |
||||
|
migrations.RemoveField( |
||||
|
model_name='organizator', |
||||
|
name='user', |
||||
|
), |
||||
|
migrations.RemoveField( |
||||
|
model_name='pohadka', |
||||
|
name='autor_old', |
||||
|
), |
||||
|
# migrations.RemoveField( |
||||
|
# model_name='pohadka', |
||||
|
# name='uloha_old', |
||||
|
# ), |
||||
|
migrations.RemoveField( |
||||
|
model_name='problem', |
||||
|
name='autor_old', |
||||
|
), |
||||
|
migrations.RemoveField( |
||||
|
model_name='problem', |
||||
|
name='body', |
||||
|
), |
||||
|
migrations.RemoveField( |
||||
|
model_name='problem', |
||||
|
name='cislo_reseni_old', |
||||
|
), |
||||
|
migrations.RemoveField( |
||||
|
model_name='problem', |
||||
|
name='cislo_zadani_old', |
||||
|
), |
||||
|
migrations.RemoveField( |
||||
|
model_name='problem', |
||||
|
name='opravovatel', |
||||
|
), |
||||
|
migrations.RemoveField( |
||||
|
model_name='problem', |
||||
|
name='text_reseni', |
||||
|
), |
||||
|
migrations.RemoveField( |
||||
|
model_name='problem', |
||||
|
name='text_zadani', |
||||
|
), |
||||
|
migrations.RemoveField( |
||||
|
model_name='problem', |
||||
|
name='typ', |
||||
|
), |
||||
|
migrations.RemoveField( |
||||
|
model_name='reseni', |
||||
|
name='body', |
||||
|
), |
||||
|
migrations.RemoveField( |
||||
|
model_name='reseni', |
||||
|
name='cislo_body', |
||||
|
), |
||||
|
migrations.RemoveField( |
||||
|
model_name='reseni', |
||||
|
name='problem_old', |
||||
|
), |
||||
|
migrations.RemoveField( |
||||
|
model_name='reseni', |
||||
|
name='resitel', |
||||
|
), |
||||
|
migrations.RemoveField( |
||||
|
model_name='resitel', |
||||
|
name='datum_narozeni', |
||||
|
), |
||||
|
migrations.RemoveField( |
||||
|
model_name='resitel', |
||||
|
name='datum_prihlaseni', |
||||
|
), |
||||
|
migrations.RemoveField( |
||||
|
model_name='resitel', |
||||
|
name='datum_souhlasu_udaje', |
||||
|
), |
||||
|
migrations.RemoveField( |
||||
|
model_name='resitel', |
||||
|
name='datum_souhlasu_zasilani', |
||||
|
), |
||||
|
migrations.RemoveField( |
||||
|
model_name='resitel', |
||||
|
name='email', |
||||
|
), |
||||
|
migrations.RemoveField( |
||||
|
model_name='resitel', |
||||
|
name='jmeno', |
||||
|
), |
||||
|
migrations.RemoveField( |
||||
|
model_name='resitel', |
||||
|
name='mesto', |
||||
|
), |
||||
|
migrations.RemoveField( |
||||
|
model_name='resitel', |
||||
|
name='pohlavi_muz', |
||||
|
), |
||||
|
migrations.RemoveField( |
||||
|
model_name='resitel', |
||||
|
name='prijmeni', |
||||
|
), |
||||
|
migrations.RemoveField( |
||||
|
model_name='resitel', |
||||
|
name='psc', |
||||
|
), |
||||
|
migrations.RemoveField( |
||||
|
model_name='resitel', |
||||
|
name='stat', |
||||
|
), |
||||
|
migrations.RemoveField( |
||||
|
model_name='resitel', |
||||
|
name='telefon', |
||||
|
), |
||||
|
migrations.RemoveField( |
||||
|
model_name='resitel', |
||||
|
name='ulice', |
||||
|
), |
||||
|
migrations.RemoveField( |
||||
|
model_name='resitel', |
||||
|
name='user', |
||||
|
), |
||||
|
# migrations.AlterField( |
||||
|
# model_name='cislo', |
||||
|
# name='verejna_vysledkovka', |
||||
|
# field=models.BooleanField(default=False, help_text='Je-li false u veřejného čísla,\t\t\t\tnení výsledkovka zatím veřejná.', verbose_name='zveřejněna výsledkovka'), |
||||
|
# ), |
||||
|
# migrations.AlterField( |
||||
|
# model_name='novinky', |
||||
|
# name='zverejneno', |
||||
|
# field=models.BooleanField(default='False', verbose_name='Zveřejněno'), |
||||
|
# ), |
||||
|
# migrations.AlterField( |
||||
|
# model_name='prijemce', |
||||
|
# name='osoba', |
||||
|
# field=models.OneToOneField(help_text='Které osobě či na jakou adresu se mají zasílat čísla', on_delete=django.db.models.deletion.CASCADE, to='seminar.Osoba', verbose_name='komu'), |
||||
|
# ), |
||||
|
# migrations.AlterField( |
||||
|
# model_name='reseni', |
||||
|
# name='cas_doruceni', |
||||
|
# field=models.DateTimeField(blank=True, default=django.utils.timezone.now, verbose_name='čas_doručení'), |
||||
|
# ), |
||||
|
] |
Loading…
Reference in new issue