From c61a5d1bd92518fbd59dd1c63ba46f18c3606ffb Mon Sep 17 00:00:00 2001 From: Anet Date: Wed, 16 Oct 2019 23:06:46 +0200 Subject: [PATCH 1/7] Zalomeni komentare na dalsi radek. --- seminar/testutils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/seminar/testutils.py b/seminar/testutils.py index bb60c11e..83a5ae4b 100644 --- a/seminar/testutils.py +++ b/seminar/testutils.py @@ -474,7 +474,8 @@ def gen_ulohy_k_tematum(rnd, rocniky, rocnik_cisla, rocnik_temata, organizatori) zad = TextNode.objects.create(text = text_zadani) uloha_zadani = UlohaZadaniNode.objects.create(uloha=p, first_child = zad) p.ulohazadaninode = uloha_zadani - otec_syn(mozna_tema_vcn, uloha_zadani) # TODO dělá se podproblém takto??? TODO + otec_syn(mozna_tema_vcn, uloha_zadani) + # TODO dělá se podproblém takto??? TODO text_vzoraku = Text.objects.create( na_web = rnd.choice(reseni), From 430d696c350839d0c853cda6fbd927e5f63ccb6a Mon Sep 17 00:00:00 2001 From: Anet Date: Wed, 16 Oct 2019 23:07:09 +0200 Subject: [PATCH 2/7] Pridany prikaz na stahovani aktualnich flatpages z produkce. --- Makefile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Makefile b/Makefile index d01fb576..c553e86f 100644 --- a/Makefile +++ b/Makefile @@ -94,6 +94,15 @@ deploy_prod: venv_check @echo Done. +sync_prod_flatpages: + @echo Downloading current version of flatpages from mamweb-prod. + ssh mam-web@gimli.ms.mff.cuni.cz \ + "cd /akce/mam/www/mamweb-prod; ./manage.py dumpdata flatpages --indent=2 > flat.json" + rsync -ave ssh mam-web@gimli.ms.mff.cuni.cz:/akce/mam/www/mamweb-prod/flat.json ./flat.json + @echo "Applying downloaded flatpages." + ./manage.py loaddata flat.json + @echo "Done." + # Sync test media directory with production sync_test_media: @if [ ${USER} != "mam-web" ]; then echo "Only possible by user mam-web"; exit 1; fi From ba546353d864eae5c61afa709f143287bb64cb72 Mon Sep 17 00:00:00 2001 From: Pavel 'LEdoian' Turinsky Date: Wed, 30 Oct 2019 23:26:59 +0100 Subject: [PATCH 3/7] =?UTF-8?q?Prvn=C3=AD=20pokus=20o=20squash.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../0001_squashed_0067_auto_20190814_0805.py | 2236 +++++++++++++++++ 1 file changed, 2236 insertions(+) create mode 100644 seminar/migrations/0001_squashed_0067_auto_20190814_0805.py diff --git a/seminar/migrations/0001_squashed_0067_auto_20190814_0805.py b/seminar/migrations/0001_squashed_0067_auto_20190814_0805.py new file mode 100644 index 00000000..f1f046af --- /dev/null +++ b/seminar/migrations/0001_squashed_0067_auto_20190814_0805.py @@ -0,0 +1,2236 @@ +# Generated by Django 2.2.6 on 2019-10-30 20:20 + +from django.conf import settings +from django.db import migrations, models +import django.db.migrations.operations.special +import django.db.models.deletion +import django.utils.timezone +import django_countries.fields +import imagekit.models.fields +import seminar.models +import taggit.managers + + +# Functions from the following migrations need manual copying. +# Move them and any dependencies into this file, then update the +# RunPython operations to refer to the local versions: + +# seminar.migrations.0051_resitel_to_osoba + +def resitel_to_osoba(apps,schema_editor): + Resitel = apps.get_model('seminar','Resitel') + Osoba = apps.get_model('seminar','Osoba') + for r in Resitel.objects.all(): + o = Osoba() + o.datum_narozeni = r.datum_narozeni + o.datum_registrace = r.datum_prihlaseni + o.datum_souhlasu_udaje = r.datum_souhlasu_udaje + o.datum_souhlasu_zasilani = r.datum_souhlasu_zasilani + o.email = r.email + o.jmeno = r.jmeno + o.mesto = r.mesto + o.pohlavi_muz = r.pohlavi_muz + o.prijmeni = r.prijmeni + o.psc = r.psc + o.stat = r.stat + o.telefon = r.telefon + o.ulice = r.ulice + o.user = r.user + if o.user: + u = o.user + if u.first_name: + if not o.jmeno: + o.jmeno = u.first_name + u.first_name = 'Použij osobu!' + elif o.jmeno == u.first_name: + u.first_name = 'Použij osobu!' + else: + raise ValueError('jmeno a first_name rozdílné: "{}" vs. "{}"'.format(o.jmeno, u.first_name)) + if u.last_name: + if not o.prijmeni: + o.prijmeni = u.last_name + u.last_name = 'Použij osobu!' + elif o.prijmeni == u.last_name: + u.last_name = 'Použij osobu!' + else: + raise ValueError('prijmeni a last_name rozdílné: "{}" vs. "{}"'.format(o.prijmeni, u.last_name)) + if u.email: + if not o.email: + o.email = u.email + u.email = 'Použij osobu!' + elif o.email == u.email: + u.email = 'Použij osobu!' + else: + raise ValueError('o.email a u.email rozdílné: "{}" vs. "{}"'.format(o.email, u.email)) + u.save() + + + o.save() + r.osoba = o + r.save() + +def osoba_to_resitel(apps, schema_editor): + Resitel = apps.get_model('seminar','Resitel') + Osoba = apps.get_model('seminar','Osoba') + for r in Resitel.objects.all(): + o = r.osoba + r.datum_narozeni = o.datum_narozeni + r.datum_prihlaseni = o.datum_registrace + r.datum_souhlasu_udaje = o.datum_souhlasu_udaje + r.datum_souhlasu_zasilani = o.datum_souhlasu_zasilani + r.email = o.email + r.jmeno = o.jmeno + r.mesto = o.mesto + r.pohlavi_muz = o.pohlavi_muz + r.prijmeni = o.prijmeni + r.psc = o.psc + r.stat = o.stat + r.telefon = o.telefon + r.ulice = o.ulice + r.user = o.user + r.save() + o.delete() + + +# seminar.migrations.0052_user_to_organizator + +def spoj_k_organizatorum_osoby(apps, scema_editor): + Organizator = apps.get_model('seminar', 'Organizator') + Resitel = apps.get_model('seminar', 'Resitel') + Osoba = apps.get_model('seminar', 'Osoba') + for org in Organizator.objects.all(): + + # Spárování organizátora s osobou + user = org.user + resitele = Resitel.objects.filter(user=user) + if resitele.count() != 0: + osoba = resitele.first().osoba + else: + osoba = Osoba(user=user) + + # Přesun informací z usera do osoby + # pro řešitele již v minule migraci + osoba.jmeno = user.first_name + osoba.prijmeni = user.last_name + osoba.email = user.email + user.jmeno = "Použij osobu!" + user.prijmeni = "Použij osobu!" + user.email = "Použij osobu!" + user.save() + + # Přesun informací z organizátora do jeho osoby + osoba.prezdivka = org.prezdivka if org.prezdivka is not None else '' + osoba.foto = org.foto + + # Všechno uložit + osoba.save() + org.osoba = osoba + org.save() + +def fix_problem(apps, schema_editor): + Problem = apps.get_model('seminar', 'Problem') + Organizator = apps.get_model('seminar', 'Organizator') + for pr in Problem.objects.all(): + if pr.autor_old is not None: + pr.autor = Organizator.objects.filter(osoba__user=pr.autor_old).first() + else: + pr.autor = None + if pr.opravovatel is not None: + pr.opravovatele.add(Organizator.objects.filter(osoba__user=pr.opravovatel).first()) + pr.save() + +def fix_pohadka(apps, schema_editor): + Pohadka = apps.get_model('seminar', 'Pohadka') + Organizator = apps.get_model('seminar', 'Organizator') + for poh in Pohadka.objects.all(): + if poh.autor_old is not None: + poh.autor = Organizator.objects.filter(osoba__user=poh.autor_old).first() + else: + poh.autor = None + poh.save() + +def fix_novinka(apps, schema_editor): + Novinky = apps.get_model('seminar', 'Novinky') + Organizator = apps.get_model('seminar', 'Organizator') + for nov in Novinky.objects.all(): + nov.autor = Organizator.objects.filter(osoba__user=nov.autor_old).first() + nov.save() + +# seminar.migrations.0053_organizator_organizuje_od_do + +def rok_to_datetime(apps,schema_editor): + Organizator = apps.get_model('seminar','Organizator') + for o in Organizator.objects.all(): + rok = o.organizuje_od_roku + if rok: + o.organizuje_od = dt.datetime(rok,1,1) + rok = o.organizuje_do_roku + if rok: + o.organizuje_do = dt.datetime(rok,12,31) + o.save() + +def datetime_to_rok(apps,schema_editor): + Organizator = apps.get_model('seminar','Organizator') + for o in Organizator.objects.all(): + o.organizuje_od_roku = o.organizuje_od.year + o.organizuje_do_roku = o.organizuje_do.year + o.save() + +# seminar.migrations.0056_vrcholy_pro_rocniky_a_cisla + +def generuj_RocnikNody_a_CisloNody(apps,schema_editor): + Rocnik = apps.get_model('seminar', 'Rocnik') + RocnikNode = apps.get_model('seminar', 'RocnikNode') + Cislo = apps.get_model('seminar', 'Cislo') + CisloNode = apps.get_model('seminar', 'CisloNode') + + last_rn = None # last_* slouží k navázání následníků + for r in Rocnik.objects.all(): + rn = RocnikNode.objects.create(rocnik=r) + rn.save() + rn.root = rn + rn.save() + if last_rn: + last_rn.succ = rn + last_rn.save() + last_rn = rn + + last_cn = None + for c in Cislo.objects.filter(rocnik=r): + cn = CisloNode.objects.create(cislo=c, root=rn) + cn.save() + if last_cn: # Jsme něčí následník + last_cn.succ = cn + last_cn.save() + else: # Jsme první v řadě, takže se musíme přidat jako first_child RočníkNodu + rn.first_child = cn + rn.save() + last_cn = cn + +# seminar.migrations.0057_reseni_to_reseni_hodnoceni + +def reseni_to_Reseni(apps, schema_editor): + Reseni = apps.get_model('seminar','Reseni') + Reseni_Resitele = apps.get_model('seminar','Reseni_Resitele') + Hodnoceni = apps.get_model('seminar','Hodnoceni') + + for r in Reseni.objects.all(): + rr = Reseni_Resitele.objects.create(resitele = r.resitel, reseni=r) + if r.body == None: + print("!!!!!!!!!!!!!!!") + print(r.id,r) + print("!!!!!!!!!!!!!!!") + else: + h = Hodnoceni.objects.create( + body=r.body, + cislo_body = r.cislo_body, + problem = r.problem_old, + reseni = r) + +# seminar.migrations.0058_problem_to_uloha_tema_clanek + +def poskladej_strom(apps, rodic, *texty): + Text = apps.get_model('seminar', 'Text') + TextNode = apps.get_model('seminar', 'TextNode') + if not rodic: + raise ValueError("Rodič musí být definovaný") + + uz_ma_deti = False + tn = None + for txt in texty: + if not txt: + continue + # Přidej do stromu: + textobj = Text.objects.create(na_web = txt) + textobj.save() + textnode = TextNode.objects.create(text = textobj) + textnode.save() + if not uz_ma_deti: + rodic.first_child = textnode + rodic.save() + tn = rodic.first_child + uz_ma_deti = True + else: + tn.succ = textnode + tn.save() + tn = tn.succ + +def uloha_to_Uloha(apps,schema_editor): + Problem = apps.get_model('seminar', 'Problem') + Uloha = apps.get_model('seminar', 'Uloha') + Text = apps.get_model('seminar', 'Text') + UlohaZadaniNode = apps.get_model('seminar', 'UlohaZadaniNode') + UlohaVzorakNode = apps.get_model('seminar', 'UlohaVzorakNode') + TextNode = apps.get_model('seminar', 'TextNode') + + ulohy = Problem.objects.filter(typ = 'uloha') + for uold in ulohy: + unew = Uloha.objects.create( + problem_ptr = uold, + # Zakomentované fieldy by se už měly nacházet v příslušném problému + #nazev = uold.nazev, + #stav = uold.stav, + #zamereni = uold.zamereni, + #poznamka = uold.poznamka, + #autor = uold.autor, + #kod = uold.kod, + cislo_zadani = uold.cislo_zadani_old, + cislo_reseni = uold.cislo_reseni_old, + max_body = uold.body, + #vytvoreno = uold.vytvoreno, + ) +# unew.opravovatele.add(*uold.opravovatele.all()) + unew.save() + + # Nody: + zadani_node = UlohaZadaniNode.objects.create(uloha = unew) + poskladej_strom(apps, zadani_node, uold.text_zadani) + zadani_node.save() + vzorak_node = UlohaVzorakNode.objects.create(uloha = unew) + poskladej_strom(apps, vzorak_node, uold.text_reseni) + vzorak_node.save() + +def konfery_rucne(apps, schema_editor): + # Tohle dělat nebudu, máme aktuálně celou jednu. Ale "Errors should never pass silently" + Problem = apps.get_model('seminar', 'Problem') + pocet_konfer = Problem.objects.filter(typ = 'konfera').count() + if pocet_konfer > 0: + raise NotImplementedError("Zkonvertuj {} konfer na objekt Konfera ručně, prosím".format(pocet_konfer)) + +def clanek_to_Clanek(apps,schema_editor): + Problem = apps.get_model('seminar', 'Problem') + Clanek = apps.get_model('seminar', 'Clanek') + ClanekNode = apps.get_model('seminar', 'ClanekNode') + Text = apps.get_model('seminar', 'Text') + TextNode = apps.get_model('seminar', 'TextNode') + + clanky = Problem.objects.filter(Q(typ='org-clanek') | Q(typ='res-clanek')) + for cl in clanky: + # Vybereme vhodné číslo pro článek z čísla zadání a čísla řešení: + if cl.cislo_zadani_old is None: + cislo = cl.cislo_reseni_old + elif cl.cislo_reseni_old is None: + cislo = cl.cislo_zadani_old + elif cl.cislo_reseni_old == cl.cislo_zadani_old: + cislo = cl.cislo_zadani_old + else: + raise ValueError("Různá čísla zadání a řešení u článku! (Článek: {})".format(cl.nazev)) + + clnew = Clanek.objects.create( + problem_ptr = cl, + # Problém by nemělo být potřeba upravovat + cislo = cislo, + # Body ignorujeme, protože už jsou v hodnocení + ) + clnew.save() + + # Aktuálně nemáme v modelu informaci o tom, jestli je to org-článek + # nebo řešitelský článek. Aby se neztratila informace, poznamenám to do + # poznámky. + cl.poznamka += "\nTyp:\t{}".format(cl.typ) + cl.save() + + # Vyrobíme nody: + clnode = ClanekNode(clanek = clnew) + poskladej_strom(apps, clnode, cl.text_zadani, cl.text_reseni) + clnode.save() + +def tema_to_Tema(apps, schema_editor): + Problem = apps.get_model('seminar', 'Problem') + Tema = apps.get_model('seminar', 'Tema') + TemaVCisleNode = apps.get_model('seminar', 'TemaVCisleNode') + Text = apps.get_model('seminar', 'Text') + TextNode = apps.get_model('seminar', 'TextNode') + + temata = Problem.objects.filter(Q(typ = 'tema') | Q(typ='serial')) + for t in temata: + # Vymyslíme správně ročník: + if t.cislo_zadani_old is None and t.cislo_reseni_old is None: + rocnik = None + elif t.cislo_zadani_old is None: + rocnik = t.cislo_reseni_old.rocnik + elif t.cislo_reseni_old is None: + rocnik = t.cislo_zadani_old.rocnik + elif t.cislo_reseni_old.rocnik == t.cislo_zadani_old.rocnik: + rocnik = t.cislo_zadani_old.rocnik + else: + raise ValueError("Nelze mít téma přes více ročníků! (Téma: {}".format(t.nazev)) + + tnew = Tema.objects.create( + problem_ptr = t, + tema_typ = t.typ, + rocnik = rocnik, + ) + tnew.save() + + # Nody: + tnode = TemaVCisleNode(tema = tnew) + poskladej_strom(apps, tnode, t.text_zadani, t.text_reseni) + tnode.save() + +# seminar.migrations.0059_vytvorit_pohadkanode + +def vytvor_pohadkanode(apps, schema_editor): + Pohadka = apps.get_model('seminar', 'Pohadka') + PohadkaNode = apps.get_model('seminar', 'PohadkaNode') + Text = apps.get_model('seminar', 'Text') + TextNode = apps.get_model('seminar', 'TextNode') + + for p in Pohadka.objects.all(): + t = Text.objects.create(na_web = p.text) + t.save() + tn = TextNode.objects.create(text = t) + tn.save() + pn = PohadkaNode.objects.create(pohadka = p, first_child = tn) + pn.save() + +# seminar.migrations.0060_spoj_stromy + +def pridej_potomka(rodic, potomek): + # Daný vrchol bude posledním potomkem rodiče + uz_ma_deti = False + posledni = None + + # Přidávaný potomek by neměl mít následovníka -- přidáváme potomka, ne podles. + if potomek.succ: + raise ValueError("Potomek má následovníka, to je velmi podezřelé!") + + # 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! + Cislo = apps.get_model('seminar', 'Cislo') + 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') + Pohadka = apps.get_model('seminar', 'Pohadka') + + for c in Cislo.objects.all().reverse(): + cnode = c.cislonode + + # Témata a seriály: + relevantni_temata = Tema.objects.filter(Q(cislo_zadani_old = c) | Q(cislo_reseni_old = c)).order_by('kod') + # Téma dáme do prvního čísla, kde se vyskytne + for t in relevantni_temata: + tnode = t.temavcislenode + if t.cislo_zadani_old and t.cislo_reseni_old: + assert(t.cislo_zadani_old <= t.cislo_reseni_old) + if t.cislo_reseni_old == c: + # Už by mělo být přidané do čísla zadání + continue + else: + # Patří sem (buď je to jediné číslo, nebo je to číslo zadání) + pridej_potomka(cnode, tnode) + + # Úložky (zadání) a pohádky + for u in Uloha.objects.filter(cislo_zadani = c).order_by('kod'): + unode = u.ulohazadaninode + pohadky_pred = Pohadka.objects.filter(uloha_old = u.problem_ptr, pred = True) + pohadky_po = Pohadka.objects.filter(uloha_old = u.problem_ptr, pred = False) + for p in pohadky_pred: + pnode = p.pohadkanode + pridej_potomka(cnode, pnode) + pridej_potomka(cnode, unode) + for p in pohadky_po: + pnode = p.pohadkanode + pridej_potomka(cnode, pnode) + + # Pohádky, které nejsou u úlohy jsou špatně: + if Pohadka.objects.exclude(uloha_old__typ='uloha').count(): + raise ValueError("Existuje pohádka, která není u úlohy") + + # Články + for cl in Clanek.objects.filter(cislo = c).order_by('kod'): + clnode = cl.claneknode + pridej_potomka(cnode, clnode) + + # Konfery + for k in Konfera.objects.all(): + knode = k.konferanode + if k.reseni and knode.root is None: + # Takováhle konfera nejspíš neexistuje + raise NotImplementedError("Konfery neumím zapojit do stromu") + + # Vzoráky + for u in Uloha.objects.filter(cislo_reseni = c).order_by('kod'): + unode = u.ulohavzoraknode + pridej_potomka(cnode, unode) + +# seminar.migrations.0065_treenode_polymorphic_ctype + +def vyrob_treenodum_ctypes(apps, schema_editor): + # Kód zkopírovaný z dokumentace: https://django-polymorphic.readthedocs.io/en/stable/migrating.html + # XXX: Nevím, jestli se tohle náhodou nemělo spustit na všech childech (jen/i) + TreeNode = apps.get_model('seminar', 'TreeNode') + ContentType = apps.get_model('contenttypes', 'ContentType') + + new_ct = ContentType.objects.get_for_model(TreeNode) + TreeNode.objects.filter(polymorphic_ctype__isnull=True).update(polymorphic_ctype=new_ct) + +# seminar.migrations.0066_problem_polymorphic_ctype + +def vyrob_problemum_ctypes(apps, schema_editor): + # Kód zkopírovaný z dokumentace: https://django-polymorphic.readthedocs.io/en/stable/migrating.html + # XXX: Nevím, jestli se tohle náhodou nemělo spustit na všech childech (jen/i) + Problem = apps.get_model('seminar', 'Problem') + ContentType = apps.get_model('contenttypes', 'ContentType') + + new_ct = ContentType.objects.get_for_model(Problem) + Problem.objects.filter(polymorphic_ctype__isnull=True).update(polymorphic_ctype=new_ct) + + +class Migration(migrations.Migration): + + replaces = [('seminar', '0001_initial'), ('seminar', '0002_add_body_views'), ('seminar', '0003_add_skola_zs_ss'), ('seminar', '0004_add_old_dakos_id'), ('seminar', '0005_alter_problem_autor'), ('seminar', '0006_problem_add_timestamp'), ('seminar', '0007_problem_zamereni'), ('seminar', '0008_reseni_forma'), ('seminar', '0009_rename_imported_IDs'), ('seminar', '0010_alter_rok_maturity'), ('seminar', '0011_alter_timestamp_def'), ('seminar', '0012_remove_soustredeni_ucastnici'), ('seminar', '0013_soustredeni_ucastnici_through_model'), ('seminar', '0014_uprava_poznamek'), ('seminar', '0015_soustredeni_text'), ('seminar', '0016_texty_problemu'), ('seminar', '0017_texty_problemu_minor'), ('seminar', '0018_problemnavrh_problemzadany'), ('seminar', '0019_rocnik_ciselne'), ('seminar', '0020_indexy_a_razeni'), ('seminar', '0021_cislo_verejna_vysledkovka'), ('seminar', '0022_decimal_body'), ('seminar', '0023_add_novinky'), ('seminar', '0024_add_organizator'), ('seminar', '0025_zmena_cesty_nahravani_obrazku'), ('seminar', '0026_soustredeni_typ'), ('seminar', '0027_export_flag_a_typ_akce'), ('seminar', '0028_add_body_celkem_views'), ('seminar', '0029_fix_body_celkem_views'), ('seminar', '0030_add_vysledky'), ('seminar', '0031_cislo_pdf'), ('seminar', '0032_cislo_pdf_blank_typos'), ('seminar', '0033_organizator_studuje_popisek'), ('seminar', '0034_reseni_forma_default_email'), ('seminar', '0035_django_imagekit'), ('seminar', '0036_add_org_to_soustredeni'), ('seminar', '0037_prispevek'), ('seminar', '0038_change_meta_prispevek'), ('seminar', '0039_pohadka'), ('seminar', '0040_pohadka_nepovinny_autor'), ('seminar', '0041_konfery'), ('seminar', '0042_cislo_faze'), ('seminar', '0043_uprava_faze'), ('seminar', '0044_uprava_faze'), ('seminar', '0045_cislo_pridani_faze_nahrano'), ('seminar', '0042_auto_20161005_0847'), ('seminar', '0046_merge'), ('seminar', '0047_auto_20170120_2118'), ('seminar', '0048_add_cislo_datum_deadline_soustredeni'), ('seminar', '0049_auto_20190430_2354'), ('seminar', '0050_auto_20190510_2228'), ('seminar', '0051_resitel_to_osoba'), ('seminar', '0052_user_to_organizator'), ('seminar', '0053_organizator_organizuje_od_do'), ('seminar', '0055_smazat_nemigrovane_zastarale_veci'), ('seminar', '0056_vrcholy_pro_rocniky_a_cisla'), ('seminar', '0057_reseni_to_reseni_hodnoceni'), ('seminar', '0058_problem_to_uloha_tema_clanek'), ('seminar', '0059_vytvorit_pohadkanode'), ('seminar', '0060_spoj_stromy'), ('seminar', '0061_kill_frankenstein'), ('seminar', '0062_redukce_modelu_pohadky'), ('seminar', '0063_procisteni_migraci'), ('seminar', '0064_auto_20190610_2358'), ('seminar', '0065_treenode_polymorphic_ctype'), ('seminar', '0066_problem_polymorphic_ctype'), ('seminar', '0067_auto_20190814_0805')] + + initial = True + + dependencies = [ + ('contenttypes', '0002_remove_content_type_name'), + ('taggit', '0001_initial'), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.CreateModel( + name='VysledkyKCislu', + fields=[ + ('dummy_id', models.CharField(db_column='id', max_length=32, primary_key=True, serialize=False, verbose_name='dummy ID pro view')), + ('body', models.IntegerField(db_column='body', verbose_name='body za číslo')), + ('body_celkem', models.IntegerField(db_column='body_celkem', verbose_name='body celkem do čísla')), + ], + options={ + 'abstract': False, + 'db_table': 'seminar_body_k_cislu', + 'managed': False, + }, + ), + migrations.CreateModel( + name='VysledkyZaCislo', + fields=[ + ('dummy_id', models.CharField(db_column='id', max_length=32, primary_key=True, serialize=False, verbose_name='dummy ID pro view')), + ('body', models.IntegerField(db_column='body', verbose_name='body za číslo')), + ], + options={ + 'abstract': False, + 'db_table': 'seminar_body_za_cislo', + 'managed': False, + }, + ), + migrations.CreateModel( + name='Cislo', + fields=[ + ('id', models.AutoField(primary_key=True, serialize=False)), + ('cislo', models.CharField(help_text='Většinou jen "1", vyjímečně "7-8", lexikograficky určije pořadí v ročníku!', max_length=32, verbose_name='název čísla')), + ('datum_vydani', models.DateField(blank=True, help_text='Datum vydání finální verze', null=True, verbose_name='datum vydání')), + ('datum_deadline', models.DateField(blank=True, help_text='Datum pro příjem řešení úloh zadaných v tomto čísle', null=True, verbose_name='datum deadline')), + ('verejne_db', models.BooleanField(db_column='verejne', default=False, verbose_name='číslo zveřejněno')), + ], + options={ + 'ordering': ['rocnik__rocnik', 'cislo'], + 'db_table': 'seminar_cisla', + 'verbose_name': 'Číslo', + 'verbose_name_plural': 'Čísla', + }, + ), + migrations.CreateModel( + name='Problem', + fields=[ + ('id', models.AutoField(primary_key=True, serialize=False)), + ('nazev', models.CharField(max_length=256, verbose_name='název')), + ('typ', models.CharField(choices=[(b'uloha', 'Úloha'), (b'tema', 'Téma'), (b'serial', 'Seriál'), (b'org-clanek', 'Organizátorský článek'), (b'res-clanek', 'Řesitelský článek')], default=b'uloha', max_length=32, verbose_name='typ problému')), + ('stav', models.CharField(choices=[(b'navrh', 'Návrh'), (b'zadany', 'Zadaný'), (b'smazany', 'Smazaný')], default=b'navrh', max_length=32, verbose_name='stav problému')), + ('text_problemu_org', models.TextField(blank=True, verbose_name='organizátorský (neveřejný) text')), + ('text_problemu', models.TextField(blank=True, verbose_name='veřejný text zadání a řešení')), + ('kod', models.CharField(blank=True, default=b'', help_text='Číslo/kód úlohy v čísle nebo kód tématu/článku/seriálu v ročníku', max_length=32, verbose_name='lokální kód')), + ('body', models.IntegerField(blank=True, null=True, verbose_name='maximum bodů')), + ('autor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='autor_uloh', to=settings.AUTH_USER_MODEL, verbose_name='autor problému')), + ('cislo_reseni', models.ForeignKey(blank=True, help_text='Číslo s řešením úlohy, jen pro úlohy', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='resene_problemy', to='seminar.Cislo', verbose_name='číslo řešení')), + ('cislo_zadani', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='zadane_problemy', to='seminar.Cislo', verbose_name='číslo zadání')), + ('opravovatel', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='opravovatel_uloh', to=settings.AUTH_USER_MODEL, verbose_name='opravovatel')), + ], + options={ + 'db_table': 'seminar_problemy', + 'verbose_name': 'Problém', + 'verbose_name_plural': 'Problémy', + }, + ), + migrations.CreateModel( + name='Resitel', + fields=[ + ('id', models.AutoField(primary_key=True, serialize=False)), + ('jmeno', models.CharField(max_length=256, verbose_name='jméno')), + ('prijmeni', models.CharField(max_length=256, verbose_name='příjmení')), + ('pohlavi_muz', models.BooleanField(default=False, verbose_name='pohlaví (muž)')), + ('rok_maturity', models.IntegerField(verbose_name='rok maturity')), + ('email', models.EmailField(blank=True, default=b'', max_length=256, verbose_name='e-mail')), + ('telefon', models.CharField(blank=True, default=b'', max_length=256, verbose_name='telefon')), + ('datum_narozeni', models.DateField(blank=True, null=True, verbose_name='datum narození')), + ('datum_souhlasu_udaje', models.DateField(blank=True, help_text='Datum souhlasu se zpracováním osobních údajů', null=True, verbose_name='datum souhlasu (údaje)')), + ('datum_souhlasu_zasilani', models.DateField(blank=True, help_text='Datum souhlasu se zasíláním MFF materiálů', null=True, verbose_name='datum souhlasu (spam)')), + ('datum_prihlaseni', models.DateField(default=django.utils.timezone.now, verbose_name='datum přihlášení')), + ('zasilat', models.CharField(choices=[(b'domu', 'Domů'), (b'do_skoly', 'Do školy'), (b'nikam', 'Nikam')], default=b'domu', max_length=32, verbose_name='kam zasílat')), + ('ulice', models.CharField(blank=True, default=b'', max_length=256, verbose_name='ulice')), + ('mesto', models.CharField(blank=True, default=b'', max_length=256, verbose_name='město')), + ('psc', models.CharField(blank=True, default=b'', max_length=32, verbose_name='PSČ')), + ('stat', django_countries.fields.CountryField(default=b'CZ', help_text='ISO 3166-1 kód země velkými písmeny (CZ, SK, ...)', max_length=2, verbose_name='stát')), + ('poznamka', models.TextField(blank=True, help_text='Neveřejná poznámka k řešiteli (plain text)', verbose_name='neveřejná poznámka')), + ], + options={ + 'ordering': ['prijmeni', 'jmeno'], + 'db_table': 'seminar_resitele', + 'verbose_name': 'Řešitel', + 'verbose_name_plural': 'Řešitelé', + }, + ), + migrations.CreateModel( + name='Rocnik', + fields=[ + ('id', models.AutoField(primary_key=True, serialize=False)), + ('prvni_rok', models.IntegerField(verbose_name='první rok')), + ('rocnik', models.CharField(max_length=16, verbose_name='číslo ročníku')), + ], + options={ + 'ordering': ['rocnik'], + 'db_table': 'seminar_rocniky', + 'verbose_name': 'Ročník', + 'verbose_name_plural': 'Ročníky', + }, + ), + migrations.CreateModel( + name='Skola', + fields=[ + ('id', models.AutoField(primary_key=True, serialize=False)), + ('aesop_id', models.CharField(blank=True, default=b'', help_text='Aesopi ID typu "izo:..." nebo "aesop:..."', max_length=32, verbose_name='Aesop ID')), + ('izo', models.CharField(blank=True, help_text='IZO školy (jen české školy)', max_length=32, verbose_name='IZO')), + ('nazev', models.CharField(help_text='Celý název školy', max_length=256, verbose_name='název')), + ('kratky_nazev', models.CharField(blank=True, help_text=b'Zkr\xc3\xa1cen\xc3\xbd n\xc3\xa1zev pro zobrazen\xc3\xad ve v\xc3\xbdsledkovce', max_length=256, verbose_name='zkrácený název')), + ('ulice', models.CharField(max_length=256, verbose_name='ulice')), + ('mesto', models.CharField(max_length=256, verbose_name='město')), + ('psc', models.CharField(max_length=32, verbose_name='PSČ')), + ('stat', django_countries.fields.CountryField(default=b'CZ', help_text='ISO 3166-1 kód zeme velkými písmeny (CZ, SK, ...)', max_length=2, verbose_name='stát')), + ('poznamka', models.TextField(blank=True, help_text='Neveřejná poznámka ke škole (plain text)', verbose_name='neveřejná poznámka')), + ], + options={ + 'db_table': 'seminar_skoly', + 'verbose_name': 'Škola', + 'verbose_name_plural': 'Školy', + }, + ), + migrations.CreateModel( + name='Soustredeni', + fields=[ + ('id', models.AutoField(primary_key=True, serialize=False)), + ('datum_zacatku', models.DateField(blank=True, help_text='První den soustředění', null=True, verbose_name='datum začátku')), + ('datum_konce', models.DateField(blank=True, help_text='Poslední den soustředění', null=True, verbose_name='datum konce')), + ('verejne_db', models.BooleanField(db_column='verejne', default=False, verbose_name='soustředění zveřejněno')), + ('misto', models.CharField(blank=True, default=b'', help_text='Místo (název obce, volitelně též objektu', max_length=256, verbose_name='místo soustředění')), + ('rocnik', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='soustredeni', to='seminar.Rocnik', verbose_name='ročník')), + ('ucastnici', models.ManyToManyField(db_table='seminar_soustredeni_ucastnici', help_text='Seznam účastníků soustředění', to='seminar.Resitel', verbose_name='účastníci soustředění')), + ], + options={ + 'ordering': ['rocnik__rocnik', 'datum_zacatku'], + 'db_table': 'seminar_soustredeni', + 'verbose_name': 'Soustředění', + 'verbose_name_plural': 'Soustředění', + }, + ), + migrations.AddField( + model_name='resitel', + name='skola', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='seminar.Skola', verbose_name='škola'), + ), + migrations.AddField( + model_name='resitel', + name='user', + field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='uživatel'), + ), + migrations.CreateModel( + name='Reseni', + fields=[ + ('id', models.AutoField(primary_key=True, serialize=False)), + ('body', models.IntegerField(blank=True, null=True, verbose_name='body')), + ('timestamp', models.DateTimeField(auto_now=True, verbose_name='vytvořeno')), + ('poznamka', models.TextField(blank=True, help_text='Neveřejná poznámka k řešení (plain text)', verbose_name='neveřejná poznámka')), + ('cislo_body', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='bodovana_reseni', to='seminar.Cislo', verbose_name='číslo pro body')), + ('problem', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='reseni', to='seminar.Problem', verbose_name='problém')), + ('resitel', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='reseni', to='seminar.Resitel', verbose_name='řešitel')), + ], + options={ + 'ordering': ['problem', 'resitel'], + 'db_table': 'seminar_reseni', + 'verbose_name': 'Řešení', + 'verbose_name_plural': 'Řešení', + }, + ), + migrations.CreateModel( + name='PrilohaReseni', + fields=[ + ('id', models.AutoField(primary_key=True, serialize=False)), + ('timestamp', models.DateTimeField(auto_now=True, verbose_name='vytvořeno')), + ('soubor', models.FileField(upload_to=seminar.models.generate_filename, verbose_name='soubor')), + ('poznamka', models.TextField(blank=True, help_text='Neveřejná poznámka k příloze řešení (plain text), např. o původu', verbose_name='neveřejná poznámka')), + ('reseni', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='prilohy', to='seminar.Reseni', verbose_name='řešení')), + ], + options={ + 'ordering': ['reseni', 'timestamp'], + 'db_table': 'seminar_priloha_reseni', + 'verbose_name': 'Příloha řešení', + 'verbose_name_plural': 'Přílohy řešení', + }, + ), + migrations.CreateModel( + name='Nastaveni', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('aktualni_cislo', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='seminar.Cislo', verbose_name='poslední vydané číslo')), + ('aktualni_rocnik', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='seminar.Rocnik', verbose_name='aktuální ročník')), + ], + options={ + 'db_table': 'seminar_nastaveni', + 'verbose_name': 'Nastavení semináře', + }, + ), + migrations.AddField( + model_name='cislo', + name='rocnik', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='cisla', to='seminar.Rocnik', verbose_name='ročník'), + ), + migrations.RunSQL( + sql="\ncreate view seminar_body_za_cislo as\n select\n sr.cislo_body_id || '-' || sr.resitel_id as id,\n sr.cislo_body_id as cislo_id,\n sr.resitel_id as resitel_id,\n sum(sr.body) as body\n from seminar_reseni as sr\n group by sr.cislo_body_id, sr.resitel_id\n order by body desc;\n\ncreate view seminar_body_k_cislu as\n select\n akt_c.id || '-' || min_bzc.resitel_id as id,\n akt_c.id as cislo_id,\n min_bzc.resitel_id as resitel_id,\n max(akt_bzc.body) as body,\n sum(min_bzc.body) as body_celkem\n from ((seminar_cisla as akt_c\n inner join seminar_cisla as min_c on min_c.rocnik_id = akt_c.rocnik_id and akt_c.cislo >= min_c.cislo)\n inner join seminar_body_za_cislo as min_bzc on min_c.id = min_bzc.cislo_id)\n left outer join seminar_body_za_cislo as akt_bzc on akt_bzc.cislo_id = akt_c.id and akt_bzc.resitel_id = min_bzc.resitel_id \n group by akt_c.id, min_bzc.resitel_id, akt_bzc.resitel_id\n order by body_celkem desc;\n", + reverse_sql='\ndrop view seminar_body_k_cislu;\ndrop view seminar_body_za_cislo;\n', + ), + migrations.AlterField( + model_name='reseni', + name='poznamka', + field=models.TextField(blank=True, help_text='Neveřejná poznámka k řešení (plain text, editace v detailu řešení)', verbose_name='neveřejná poznámka'), + ), + migrations.AddField( + model_name='skola', + name='je_ss', + field=models.BooleanField(default=True, verbose_name='střední stupeň'), + ), + migrations.AddField( + model_name='skola', + name='je_zs', + field=models.BooleanField(default=True, verbose_name='základní stupeň'), + ), + migrations.AlterField( + model_name='problem', + name='autor', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='autor_uloh', to=settings.AUTH_USER_MODEL, verbose_name='autor problému'), + ), + migrations.AddField( + model_name='problem', + name='zamereni', + field=taggit.managers.TaggableManager(blank=True, help_text=b'Zam\xc4\x9b\xc5\x99en\xc3\xad M/F/I/O probl\xc3\xa9mu, p\xc5\x99\xc3\xadp. dal\xc5\xa1\xc3\xad tagy', through='taggit.TaggedItem', to='taggit.Tag', verbose_name='zaměření'), + ), + migrations.AddField( + model_name='reseni', + name='forma', + field=models.CharField(choices=[(b'papir', 'Papírové řešení'), (b'email', 'Emailem'), (b'upload', 'Upload přes web')], default=b'papir', max_length=16, verbose_name='forma řešení'), + ), + migrations.AddField( + model_name='resitel', + name='import_mamoper_id', + field=models.CharField(blank=True, default=b'', help_text='MAMOPER.MM_RIESITELIA.ID z DAKOS importu, jen historický význam', max_length=32, verbose_name='importované MM_RIESITELIA.ID'), + ), + migrations.AddField( + model_name='skola', + name='import_dakos_id', + field=models.CharField(blank=True, default=b'', help_text='DKSROOT.V_SKOLA.ID z DAKOS importu, jen historický význam', max_length=32, verbose_name='importované DKSROOT.V_SKOLA.ID'), + ), + migrations.AlterField( + model_name='resitel', + name='rok_maturity', + field=models.IntegerField(blank=True, null=True, verbose_name='rok maturity'), + ), + migrations.AlterField( + model_name='prilohareseni', + name='timestamp', + field=models.DateTimeField(blank=True, default=django.utils.timezone.now, editable=False, verbose_name='vytvořeno'), + ), + migrations.AddField( + model_name='problem', + name='import_dakos_id', + field=models.CharField(blank=True, default=b'', help_text='ID z importu z DAKOSU s prefixem podle původu: "AZAD:xxx (MAMOPER.MM_AZAD), ""DOZ:xxx" (MAMOPER.MM_DOZ), "ZAD:rocnik.cislo.uloha.typ" (MAMOPER.MM_ZADANIA), "ULOHA:xxx" (MAMOPER.MM_ULOHY)', max_length=32, verbose_name='importované ID s typem'), + ), + migrations.AddField( + model_name='problem', + name='timestamp', + field=models.DateTimeField(blank=True, default=django.utils.timezone.now, editable=False, verbose_name='vytvořeno'), + ), + migrations.AlterField( + model_name='reseni', + name='timestamp', + field=models.DateTimeField(blank=True, default=django.utils.timezone.now, editable=False, verbose_name='vytvořeno'), + ), + migrations.RemoveField( + model_name='soustredeni', + name='ucastnici', + ), + migrations.CreateModel( + name='Soustredeni_Ucastnici', + fields=[ + ('id', models.AutoField(primary_key=True, serialize=False)), + ('poznamka', models.TextField(blank=True, help_text='Neveřejná poznámka k účasti (plain text)', verbose_name='neveřejná poznámka')), + ('resitel', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='seminar.Resitel', verbose_name='řešitel')), + ('soustredeni', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='seminar.Soustredeni', verbose_name='soustředění')), + ], + options={ + 'ordering': ['soustredeni', 'resitel'], + 'db_table': 'seminar_soustredeni_ucastnici', + 'verbose_name': 'Účast na soustředění', + 'verbose_name_plural': 'Účasti na soustředění', + }, + ), + migrations.AddField( + model_name='soustredeni', + name='ucastnici', + field=models.ManyToManyField(help_text='Seznam účastníků soustředění', through='seminar.Soustredeni_Ucastnici', to='seminar.Resitel', verbose_name='účastníci soustředění'), + ), + migrations.AlterModelOptions( + name='problem', + options={'ordering': ['nazev'], 'verbose_name': 'Problém', 'verbose_name_plural': 'Problémy'}, + ), + migrations.AlterModelOptions( + name='reseni', + options={'ordering': ['problem_id', 'resitel_id'], 'verbose_name': 'Řešení', 'verbose_name_plural': 'Řešení'}, + ), + migrations.AlterModelOptions( + name='skola', + options={'ordering': ['mesto', 'nazev'], 'verbose_name': 'Škola', 'verbose_name_plural': 'Školy'}, + ), + migrations.AddField( + model_name='cislo', + name='poznamka', + field=models.TextField(blank=True, help_text='Neveřejná poznámka k číslu (plain text)', verbose_name='neveřejná poznámka'), + ), + migrations.AlterField( + model_name='reseni', + name='poznamka', + field=models.TextField(blank=True, help_text='Neveřejná poznámka k řešení (plain text)', verbose_name='neveřejná poznámka'), + ), + migrations.AddField( + model_name='soustredeni', + name='text', + field=models.TextField(blank=True, default=b'', verbose_name='text k soustředění (HTML)'), + ), + migrations.RenameField( + model_name='problem', + old_name='text_problemu_org', + new_name='text_org', + ), + migrations.AlterField( + model_name='problem', + name='text_org', + field=models.TextField(blank=True, verbose_name='neveřejné zadání a organizátorské a poznámky'), + ), + migrations.RenameField( + model_name='problem', + old_name='text_problemu', + new_name='text_zadani', + ), + migrations.AlterField( + model_name='problem', + name='text_org', + field=models.TextField(blank=True, help_text='Neveřejný návrh úlohy, návrh řešení, text zadání, poznámky ...', verbose_name='org poznámky (HTML)'), + ), + migrations.AlterField( + model_name='problem', + name='text_zadani', + field=models.TextField(blank=True, help_text='Veřejný text zadání (HTML)', verbose_name='veřejné zadání (HTML)'), + ), + migrations.AddField( + model_name='problem', + name='text_reseni', + field=models.TextField(blank=True, help_text='Veřejný text řešení (HTML, u témat i příspěvky a komentáře)', verbose_name='veřejné řešení (HTML)'), + ), + migrations.CreateModel( + name='ProblemNavrh', + fields=[ + ], + options={ + 'verbose_name': 'Problém (návrh)', + 'proxy': True, + 'verbose_name_plural': 'Problémy (návrhy)', + }, + bases=('seminar.problem',), + ), + migrations.CreateModel( + name='ProblemZadany', + fields=[ + ], + options={ + 'verbose_name': 'Problém (zadaný)', + 'proxy': True, + 'verbose_name_plural': 'Problémy (zadané)', + }, + bases=('seminar.problem',), + ), + migrations.AddField( + model_name='rocnik', + name='rocnik_n', + field=models.IntegerField(default=0, verbose_name='číslo ročníku'), + preserve_default=False, + ), + migrations.RunSQL( + sql='update seminar_rocniky set rocnik_n = cast (rocnik as integer)', + ), + migrations.RemoveField( + model_name='rocnik', + name='rocnik', + ), + migrations.RenameField( + model_name='rocnik', + old_name='rocnik_n', + new_name='rocnik', + ), + migrations.AlterModelOptions( + name='cislo', + options={'ordering': ['-rocnik__rocnik', '-cislo'], 'verbose_name': 'Číslo', 'verbose_name_plural': 'Čísla'}, + ), + migrations.AlterModelOptions( + name='reseni', + options={'ordering': ['problem_id', 'resitel__prijmeni', 'resitel__jmeno'], 'verbose_name': 'Řešení', 'verbose_name_plural': 'Řešení'}, + ), + migrations.AlterModelOptions( + name='rocnik', + options={'ordering': ['-rocnik'], 'verbose_name': 'Ročník', 'verbose_name_plural': 'Ročníky'}, + ), + migrations.AlterField( + model_name='cislo', + name='cislo', + field=models.CharField(db_index=True, help_text='Většinou jen "1", vyjímečně "7-8", lexikograficky určije pořadí v ročníku!', max_length=32, verbose_name='název čísla'), + ), + migrations.AlterField( + model_name='rocnik', + name='prvni_rok', + field=models.IntegerField(db_index=True, unique=True, verbose_name='první rok'), + ), + migrations.AlterField( + model_name='rocnik', + name='rocnik', + field=models.IntegerField(db_index=True, unique=True, verbose_name='číslo ročníku'), + ), + migrations.AddField( + model_name='cislo', + name='verejna_vysledkovka', + field=models.BooleanField(default=False, help_text='Je-li false u veřejného čísla, není výsledkovka zatím veřejná.', verbose_name='zveřejněna výsledkovka'), + ), + migrations.RunSQL( + sql='\ndrop view seminar_body_k_cislu;\ndrop view seminar_body_za_cislo;\n', + ), + migrations.AlterField( + model_name='problem', + name='body', + field=models.DecimalField(blank=True, decimal_places=1, max_digits=8, null=True, verbose_name='maximum bodů'), + ), + migrations.AlterField( + model_name='reseni', + name='body', + field=models.DecimalField(blank=True, decimal_places=1, max_digits=8, null=True, verbose_name='body'), + ), + migrations.RunSQL( + sql="\ncreate view seminar_body_za_cislo as\n select\n sr.cislo_body_id || '-' || sr.resitel_id as id,\n sr.cislo_body_id as cislo_id,\n sr.resitel_id as resitel_id,\n sum(sr.body) as body\n from seminar_reseni as sr\n group by sr.cislo_body_id, sr.resitel_id\n order by body desc;\n\ncreate view seminar_body_k_cislu as\n select\n akt_c.id || '-' || min_bzc.resitel_id as id,\n akt_c.id as cislo_id,\n min_bzc.resitel_id as resitel_id,\n max(akt_bzc.body) as body,\n sum(min_bzc.body) as body_celkem\n from ((seminar_cisla as akt_c\n inner join seminar_cisla as min_c on min_c.rocnik_id = akt_c.rocnik_id and akt_c.cislo >= min_c.cislo)\n inner join seminar_body_za_cislo as min_bzc on min_c.id = min_bzc.cislo_id)\n left outer join seminar_body_za_cislo as akt_bzc on akt_bzc.cislo_id = akt_c.id and akt_bzc.resitel_id = min_bzc.resitel_id \n group by akt_c.id, min_bzc.resitel_id, akt_bzc.resitel_id\n order by body_celkem desc;\n", + ), + migrations.CreateModel( + name='Novinky', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('datum', models.DateField(auto_now_add=True)), + ('text', models.TextField(blank=True, null=True, verbose_name=b'Text novinky')), + ('obrazek', models.ImageField(blank=True, null=True, upload_to=b'image_novinky/%Y/%m/%d/', verbose_name=b'Obr\xc3\xa1zek')), + ('zverejneno', models.BooleanField(default=False, verbose_name=b'Zve\xc5\x99ejn\xc4\x9bno')), + ('autor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name=b'Autor novinky')), + ], + options={ + 'verbose_name': 'Novinka', + 'verbose_name_plural': 'Novinky', + }, + ), + migrations.CreateModel( + name='Organizator', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('prezdivka', models.CharField(blank=True, max_length=32, null=True, verbose_name=b'P\xc5\x99ezd\xc3\xadvka')), + ('organizuje_od_roku', models.IntegerField(blank=True, null=True, verbose_name=b'Organizuje od roku')), + ('organizuje_do_roku', models.IntegerField(blank=True, null=True, verbose_name=b'Organizuje do roku')), + ('studuje', models.CharField(blank=True, max_length=256, null=True, verbose_name=b'Studuje')), + ('strucny_popis_organizatora', models.TextField(blank=True, null=True, verbose_name=b'Stru\xc4\x8dn\xc3\xbd popis organiz\xc3\xa1tora')), + ('foto', models.ImageField(blank=True, help_text=b'Vlo\xc5\xbe fotografii organiz\xc3\xa1tora o libovon\xc3\xa9 velikosti', null=True, upload_to=b'image_organizatori/velke/%Y/', verbose_name=b'Fotografie organiz\xc3\xa1tora')), + ('foto_male', models.ImageField(blank=True, editable=False, null=True, upload_to=b'image_organizatori/male/%Y/')), + ('user', models.OneToOneField(help_text=b'Vyber \xc3\xba\xc4\x8det sp\xc5\x99a\xc5\xbeen\xc3\xbd s organiz\xc3\xa1torem.', on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name=b'Osoba')), + ], + options={ + 'verbose_name': 'Organizátor', + 'verbose_name_plural': 'Organizátoři', + }, + ), + migrations.AddField( + model_name='rocnik', + name='exportovat', + field=models.BooleanField(db_column='exportovat', default=False, help_text='Exportuje se jen podle tohoto flagu (ne veřejnosti), a to jen čísla s veřejnou výsledkovkou', verbose_name='export do AESOPa'), + ), + migrations.AddField( + model_name='soustredeni', + name='exportovat', + field=models.BooleanField(db_column='exportovat', default=False, help_text='Exportuje se jen podle tohoto flagu (ne veřejnosti)', verbose_name='export do AESOPa'), + ), + migrations.AddField( + model_name='soustredeni', + name='typ', + field=models.CharField(choices=[(b'jarni', 'Jarní soustředění'), (b'podzimni', 'Podzimní soustředění'), (b'vikend', 'Víkendový sraz')], default=b'podzimni', max_length=16, verbose_name='typ akce'), + ), + migrations.RunSQL( + sql="\ndrop view seminar_body_k_cislu;\ndrop view seminar_body_za_cislo;\n\ncreate view seminar_body_za_cislo as\n select\n seminar_reseni.cislo_body_id || '-' || seminar_reseni.resitel_id as id,\n seminar_reseni.cislo_body_id as cislo_id,\n seminar_reseni.resitel_id as resitel_id,\n seminar_cisla.cislo as cislo,\n seminar_cisla.rocnik_id as rocnik_id,\n seminar_rocniky.rocnik as rocnik,\n seminar_cisla.verejna_vysledkovka as verejna_vysledkovka,\n sum(seminar_reseni.body) as body\n from\n seminar_reseni\n inner join seminar_cisla on seminar_reseni.cislo_body_id = seminar_cisla.id\n inner join seminar_rocniky on seminar_cisla.rocnik_id = seminar_rocniky.id\n group by seminar_reseni.cislo_body_id, seminar_reseni.resitel_id, seminar_cisla.cislo,\n seminar_cisla.rocnik_id, seminar_rocniky.rocnik, seminar_cisla.verejna_vysledkovka\n order by body desc;\n\ncreate view seminar_body_k_cislu_rocnik as\n select\n akt_body.id as id,\n akt_body.cislo_id as cislo_id,\n akt_body.resitel_id as resitel_id,\n akt_body.body as body,\n sum(min_body.body) as body_celkem\n from\n seminar_body_za_cislo as akt_body\n inner join seminar_body_za_cislo as min_body on\n (akt_body.resitel_id = min_body.resitel_id and\n (akt_body.rocnik = min_body.rocnik and akt_body.cislo >= min_body.cislo)\n )\n group by akt_body.id, akt_body.cislo_id, akt_body.resitel_id, akt_body.body\n order by body_celkem desc;\n\ncreate view seminar_body_k_cislu_odjakziva as\n select\n akt_body.id as id,\n akt_body.cislo_id as cislo_id,\n akt_body.resitel_id as resitel_id,\n akt_body.body as body,\n sum(min_body.body) as body_celkem\n from\n seminar_body_za_cislo as akt_body\n inner join seminar_body_za_cislo as min_body on\n (akt_body.resitel_id = min_body.resitel_id and\n ((akt_body.rocnik = min_body.rocnik and akt_body.cislo >= min_body.cislo) or\n (akt_body.rocnik < min_body.rocnik)\n )\n )\n group by akt_body.id, akt_body.cislo_id, akt_body.resitel_id, akt_body.body\n order by body_celkem desc;\n\n", + ), + migrations.RunSQL( + sql="\n\ndrop view seminar_body_k_cislu_rocnik;\ncreate view seminar_body_k_cislu_rocnik as\n select\n seminar_cisla.id || '-' || min_body.resitel_id as id,\n seminar_cisla.id as cislo_id,\n min_body.resitel_id as resitel_id,\n sum(min_body.body) as body\n from\n seminar_cisla\n inner join seminar_body_za_cislo as min_body on\n (min_body.rocnik_id = seminar_cisla.rocnik_id and seminar_cisla.cislo >= min_body.cislo)\n group by seminar_cisla.id, min_body.resitel_id\n order by body desc;\n\ndrop view seminar_body_k_cislu_odjakziva;\ncreate view seminar_body_k_cislu_odjakziva as\n select\n seminar_cisla.id || '-' || min_body.resitel_id as id,\n seminar_cisla.id as cislo_id,\n min_body.resitel_id as resitel_id,\n sum(min_body.body) as body\n from\n seminar_cisla\n inner join seminar_rocniky on\n (seminar_cisla.rocnik_id = seminar_rocniky.id)\n inner join seminar_body_za_cislo as min_body on\n (min_body.rocnik_id = seminar_cisla.rocnik_id and seminar_cisla.cislo >= min_body.cislo) or\n (min_body.rocnik < seminar_rocniky.rocnik)\n group by seminar_cisla.id, min_body.resitel_id\n order by body desc;\n", + ), + migrations.CreateModel( + name='VysledkyCelkemKCislu', + fields=[ + ('dummy_id', models.CharField(db_column=b'id', max_length=32, primary_key=True, serialize=False, verbose_name='dummy ID pro view')), + ('body', models.DecimalField(db_column=b'body', decimal_places=1, max_digits=8, verbose_name='body za číslo')), + ('body_celkem', models.DecimalField(db_column=b'body_celkem', decimal_places=1, max_digits=8, verbose_name='body celkem do čísla včetně minulých ročníků')), + ], + options={ + 'abstract': False, + 'db_table': 'seminar_body_celkem_k_cislu', + 'managed': False, + }, + ), + migrations.CreateModel( + name='VysledkyKCisluOdjakziva', + fields=[ + ('dummy_id', models.CharField(db_column=b'id', max_length=32, primary_key=True, serialize=False, verbose_name='dummy ID pro view')), + ('body', models.DecimalField(db_column=b'body', decimal_places=1, max_digits=8, verbose_name='body za číslo')), + ], + options={ + 'abstract': False, + 'db_table': 'seminar_body_k_cislu_odjakziva', + 'managed': False, + }, + ), + migrations.CreateModel( + name='VysledkyKCisluZaRocnik', + fields=[ + ('dummy_id', models.CharField(db_column=b'id', max_length=32, primary_key=True, serialize=False, verbose_name='dummy ID pro view')), + ('body', models.DecimalField(db_column=b'body', decimal_places=1, max_digits=8, verbose_name='body za číslo')), + ], + options={ + 'abstract': False, + 'db_table': 'seminar_body_k_cislu_rocnik', + 'managed': False, + }, + ), + migrations.AlterField( + model_name='organizator', + name='foto', + field=models.ImageField(blank=True, help_text=b'Vlo\xc5\xbe fotografii organiz\xc3\xa1tora o libovoln\xc3\xa9 velikosti', null=True, upload_to=b'image_organizatori/velke/%Y/', verbose_name=b'Fotografie organiz\xc3\xa1tora'), + ), + migrations.AlterModelOptions( + name='soustredeni', + options={'ordering': ['-rocnik__rocnik', '-datum_zacatku'], 'verbose_name': 'Soustředění', 'verbose_name_plural': 'Soustředění'}, + ), + migrations.AlterField( + model_name='cislo', + name='cislo', + field=models.CharField(db_index=True, help_text='Většinou jen "1", vyjímečně "7-8", lexikograficky určuje pořadí v ročníku!', max_length=32, verbose_name='název čísla'), + ), + migrations.AddField( + model_name='cislo', + name='pdf', + field=models.FileField(blank=True, help_text='Pdf čísla, které si mohou řešitelé stáhnout', null=True, upload_to=seminar.models.cislo_pdf_filename, verbose_name='pdf'), + ), + migrations.AlterField( + model_name='problem', + name='typ', + field=models.CharField(choices=[(b'uloha', 'Úloha'), (b'tema', 'Téma'), (b'serial', 'Seriál'), (b'org-clanek', 'Organizátorský článek'), (b'res-clanek', 'Řešitelský článek')], default=b'uloha', max_length=32, verbose_name='typ problému'), + ), + migrations.AlterField( + model_name='skola', + name='stat', + field=django_countries.fields.CountryField(default=b'CZ', help_text='ISO 3166-1 kód země velkými písmeny (CZ, SK, ...)', max_length=2, verbose_name='stát'), + ), + migrations.AlterField( + model_name='organizator', + name='studuje', + field=models.CharField(blank=True, help_text=b"Nap\xc5\x99. 'Studuje Obecnou fyziku (Bc.), 3. ro\xc4\x8dn\xc3\xadk', 'Vystudovala Diskr\xc3\xa9tn\xc3\xad modely a algoritmy (Mgr.)' nebo 'P\xc5\x99edn\xc3\xa1\xc5\xa1\xc3\xad na MFF'", max_length=256, null=True, verbose_name=b'Studium aj.'), + ), + migrations.AlterField( + model_name='reseni', + name='forma', + field=models.CharField(choices=[(b'papir', 'Papírové řešení'), (b'email', 'Emailem'), (b'upload', 'Upload přes web')], default=b'email', max_length=16, verbose_name='forma řešení'), + ), + migrations.RemoveField( + model_name='organizator', + name='foto_male', + ), + migrations.AlterField( + model_name='organizator', + name='foto', + field=imagekit.models.fields.ProcessedImageField(blank=True, help_text=b'Vlo\xc5\xbe fotografii organiz\xc3\xa1tora o libovoln\xc3\xa9 velikosti', null=True, upload_to=b'image_organizatori/velke/%Y/', verbose_name=b'Fotografie organiz\xc3\xa1tora'), + ), + migrations.CreateModel( + name='Soustredeni_Organizatori', + fields=[ + ('id', models.AutoField(primary_key=True, serialize=False)), + ('poznamka', models.TextField(blank=True, help_text='Neveřejná poznámka k účasti organizátora (plain text)', verbose_name='neveřejná poznámka')), + ('organizator', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='seminar.Organizator', verbose_name='organizátor')), + ('soustredeni', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='seminar.Soustredeni', verbose_name='soustředění')), + ], + options={ + 'ordering': ['soustredeni', 'organizator'], + 'db_table': 'seminar_soustredeni_organizatori', + 'verbose_name': 'Účast organizátorů na soustředění', + 'verbose_name_plural': 'Účasti organizátorů na soustředění', + }, + ), + migrations.AddField( + model_name='soustredeni', + name='organizatori', + field=models.ManyToManyField(help_text='Seznam organizátorů soustředění', through='seminar.Soustredeni_Organizatori', to='seminar.Organizator', verbose_name='Organizátoři soustředění'), + ), + migrations.CreateModel( + name='Prispevek', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('nazev', models.CharField(max_length=200, verbose_name=b'N\xc3\xa1zev')), + ('text_org', models.TextField(blank=True, null=True, verbose_name=b'Orgovsk\xc3\xbd text')), + ('text_resitel', models.TextField(blank=True, null=True, verbose_name=b'\xc5\x98e\xc5\xa1itelsk\xc3\xbd text')), + ('zverejnit', models.BooleanField(verbose_name=b'Zve\xc5\x99ejnit?')), + ('problem', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='seminar.Problem', verbose_name=b'Probl\xc3\xa9m')), + ('reseni', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='seminar.Reseni', verbose_name=b'\xc5\x98e\xc5\xa1en\xc3\xad')), + ], + options={ + 'abstract': False, + 'verbose_name': 'Příspěvek k problému', + 'verbose_name_plural': 'Příspěvky k problémům', + }, + ), + migrations.CreateModel( + name='Konfera', + fields=[ + ('id', models.AutoField(primary_key=True, serialize=False)), + ('nazev', models.CharField(help_text='Název konfery', max_length=40, verbose_name='název konfery')), + ('popis', models.TextField(blank=True, help_text='Popis konfery k zobrazení na webu', verbose_name='popis konfery')), + ('abstrakt', models.TextField(blank=True, help_text='Abstrakt konfery tak, jak byl uveden ve sborníku', verbose_name='abstrakt')), + ('org_poznamka', models.TextField(blank=True, help_text='Neveřejná poznámka ke konfeře(plain text)', verbose_name='neveřejná poznámka')), + ('typ_prezentace', models.CharField(choices=[(b'veletrh', 'Veletrh (postery)'), (b'prezentace', 'Prezentace (přednáška)')], default=b'veletrh', max_length=16, verbose_name='typ prezentace')), + ('prezentace', models.FileField(help_text='Prezentace nebo fotka posteru', upload_to=seminar.models.generate_filename_konfera, verbose_name='prezentace')), + ('materialy', models.FileField(help_text='Další materiály ke konfeře zabalené do jednoho souboru', upload_to=seminar.models.generate_filename_konfera, verbose_name='materialy')), + ('organizator', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='konfery', to='seminar.Organizator', verbose_name='organizátor')), + ('soustredeni', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='konfery', to='seminar.Soustredeni', verbose_name='soustředění')), + ], + options={ + 'db_table': 'seminar_konfera', + 'verbose_name': 'Konfera', + 'verbose_name_plural': 'Konfery', + }, + ), + migrations.CreateModel( + name='Konfery_Ucastnici', + fields=[ + ('id', models.AutoField(primary_key=True, serialize=False)), + ('poznamka', models.TextField(blank=True, help_text='Neveřejná poznámka k účasti (plain text)', verbose_name='neveřejná poznámka')), + ('konfera', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Konfera', verbose_name='konfera')), + ('resitel', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='seminar.Resitel', verbose_name='řešitel')), + ], + options={ + 'ordering': ['konfera', 'resitel'], + 'db_table': 'seminar_konfery_ucastnici', + 'verbose_name': 'Účast na konfeře', + 'verbose_name_plural': 'Účasti na konfeře', + }, + ), + migrations.AlterField( + model_name='problem', + name='typ', + field=models.CharField(choices=[(b'uloha', 'Úloha'), (b'tema', 'Téma'), (b'serial', 'Seriál'), (b'konfera', 'Konfera'), (b'org-clanek', 'Organizátorský článek'), (b'res-clanek', 'Řešitelský článek')], default=b'uloha', max_length=32, verbose_name='typ problému'), + ), + migrations.AddField( + model_name='konfera', + name='ucastnici', + field=models.ManyToManyField(help_text='Seznam účastníků konfery', through='seminar.Konfery_Ucastnici', to='seminar.Resitel', verbose_name='účastníci konfery'), + ), + migrations.AlterField( + model_name='konfera', + name='materialy', + field=models.FileField(blank=True, help_text='Další materiály ke konfeře zabalené do jednoho souboru', upload_to=seminar.models.generate_filename_konfera, verbose_name='materialy'), + ), + migrations.AlterField( + model_name='konfera', + name='prezentace', + field=models.FileField(blank=True, help_text='Prezentace nebo fotka posteru', upload_to=seminar.models.generate_filename_konfera, verbose_name='prezentace'), + ), + migrations.AddField( + model_name='konfera', + name='prispevek', + field=models.ForeignKey(blank=True, help_text='Účastnický přípěvek o konfeře', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='konfery', to='seminar.Problem', verbose_name='příspěvek do čísla'), + ), + migrations.AddField( + model_name='cislo', + name='faze', + field=models.CharField(choices=[('admin', 'Úpravy na webu'), ('tex', 'Úpravy v TeXu'), ('nahrano', 'Nahráno na web')], default='admin', help_text='Během fáze "Úpravy na webu" se obsah čísla vytváří (a případně komentuje) ve webovém rozhraní. Během fáze "Úpravy v TeXu" už obsah ve webovém rozhraní editovat nelze a návrhy na úpravy se píší do korekturovátka a zanášejí do gitu. Z něj se pak vygeneruje verze pro web a číslo se přepne do fáze "Nahráno na web", což jen znamená, že už nejde automaticky stáhnout obsah pro založení čísla v TeXu.', max_length=32, verbose_name='Fáze vytváření obsahu'), + ), + migrations.AddField( + model_name='cislo', + name='datum_deadline_soustredeni', + field=models.DateField(blank=True, help_text='Datum pro příjem řešení pro účast na soustředění', null=True, verbose_name='datum deadline soustředění'), + ), + migrations.CreateModel( + name='Osoba', + fields=[ + ('id', models.AutoField(primary_key=True, serialize=False)), + ('jmeno', models.CharField(max_length=256, verbose_name='jméno')), + ('prijmeni', models.CharField(max_length=256, verbose_name='příjmení')), + ('prezdivka', models.CharField(max_length=256, verbose_name='přezdívka')), + ('pohlavi_muz', models.BooleanField(default=False, verbose_name='pohlaví (muž)')), + ('email', models.EmailField(blank=True, default='', max_length=256, verbose_name='e-mail')), + ('telefon', models.CharField(blank=True, default='', max_length=256, verbose_name='telefon')), + ('datum_narozeni', models.DateField(blank=True, null=True, verbose_name='datum narození')), + ('datum_souhlasu_udaje', models.DateField(blank=True, help_text='Datum souhlasu se zpracováním osobních údajů', null=True, verbose_name='datum souhlasu (údaje)')), + ('datum_souhlasu_zasilani', models.DateField(blank=True, help_text='Datum souhlasu se zasíláním MFF materiálů', null=True, verbose_name='datum souhlasu (spam)')), + ('datum_registrace', models.DateField(default=django.utils.timezone.now, verbose_name='datum registrace do semináře')), + ('ulice', models.CharField(blank=True, default='', max_length=256, verbose_name='ulice')), + ('mesto', models.CharField(blank=True, default='', max_length=256, verbose_name='město')), + ('psc', models.CharField(blank=True, default='', max_length=32, verbose_name='PSČ')), + ('stat', django_countries.fields.CountryField(default='CZ', help_text='ISO 3166-1 kód země velkými písmeny (CZ, SK, ...)', max_length=2, verbose_name='stát')), + ('poznamka', models.TextField(blank=True, help_text='Neveřejná poznámka k osobě (plain text)', verbose_name='neveřejná poznámka')), + ('foto', imagekit.models.fields.ProcessedImageField(blank=True, help_text='Vlož fotografii osoby o libovolné velikosti', null=True, upload_to='image_osoby/velke/%Y/', verbose_name='Fotografie osoby')), + ('user', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='uživatel')), + ], + options={ + 'verbose_name': 'Osoba', + 'verbose_name_plural': 'Osoby', + 'db_table': 'seminar_osoby', + 'ordering': ['prijmeni', 'jmeno'], + }, + ), + migrations.CreateModel( + name='Prijemce', + fields=[ + ('id', models.AutoField(primary_key=True, serialize=False)), + ('poznamka', models.TextField(blank=True, help_text='Neveřejná poznámka k příemci čísel (plain text)', verbose_name='neveřejná poznámka')), + ('osoba', models.ForeignKey(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')), + ], + options={ + 'verbose_name': 'příjemce', + 'verbose_name_plural': 'příjemce', + 'db_table': 'seminar_prijemce', + }, + ), + migrations.CreateModel( + name='Text', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('na_web', models.TextField(blank=True, help_text='Text ke zveřejnění na webu', verbose_name='text na web')), + ('do_cisla', models.TextField(blank=True, help_text='Text ke zveřejnění v čísle', verbose_name='text do čísla')), + ], + options={ + 'verbose_name': 'text', + 'verbose_name_plural': 'texty', + 'db_table': 'seminar_texty', + }, + ), + migrations.CreateModel( + name='Uloha', + fields=[ + ('problem_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='seminar.Problem')), + ('max_body', models.DecimalField(blank=True, decimal_places=1, max_digits=8, null=True, verbose_name='maximum bodů')), + ], + options={ + 'verbose_name': 'Úloha', + 'verbose_name_plural': 'Úlohy', + 'db_table': 'seminar_ulohy', + }, + bases=('seminar.problem',), + ), + migrations.AlterModelOptions( + name='novinky', + options={'ordering': ['-datum'], 'verbose_name': 'Novinka', 'verbose_name_plural': 'Novinky'}, + ), + migrations.AlterModelOptions( + name='prilohareseni', + options={'ordering': ['reseni', 'vytvoreno'], 'verbose_name': 'Příloha řešení', 'verbose_name_plural': 'Přílohy řešení'}, + ), + migrations.AlterModelOptions( + name='reseni', + options={'ordering': ['-cas_doruceni'], 'verbose_name': 'Řešení', 'verbose_name_plural': 'Řešení'}, + ), + migrations.AlterModelOptions( + name='resitel', + options={'ordering': ['osoba'], 'verbose_name': 'Řešitel', 'verbose_name_plural': 'Řešitelé'}, + ), + migrations.RenameField( + model_name='konfera', + old_name='org_poznamka', + new_name='poznamka', + ), + migrations.RenameField( + model_name='reseni', + old_name='timestamp', + new_name='cas_doruceni', + ), + migrations.RenameField( + model_name='prilohareseni', + old_name='timestamp', + new_name='vytvoreno', + ), + migrations.RenameField( + model_name='problem', + old_name='text_org', + new_name='poznamka', + ), + migrations.RenameField( + model_name='problem', + old_name='timestamp', + new_name='vytvoreno', + ), + migrations.RenameField( + model_name='problem', + old_name='cislo_zadani', + new_name='cislo_zadani_old', + ), + migrations.RenameField( + model_name='problem', + old_name='cislo_reseni', + new_name='cislo_reseni_old', + ), + migrations.AddField( + model_name='konfera', + name='anotace', + field=models.TextField(blank=True, help_text='Popis, o čem bude konfera.', verbose_name='anotace'), + ), + migrations.AddField( + model_name='organizator', + name='organizuje_do', + field=models.DateTimeField(blank=True, null=True, verbose_name='Organizuje do'), + ), + migrations.AddField( + model_name='organizator', + name='organizuje_od', + field=models.DateTimeField(blank=True, null=True, verbose_name='Organizuje od'), + ), + migrations.AddField( + model_name='organizator', + name='skola', + field=models.CharField(blank=True, help_text='Škola, např. MFF, VŠCHT, VUT, ... prostě aby se nemuselo psát do studuješkolu, ale jen obor, možnost zobrazit zvlášť', max_length=256, null=True, verbose_name='Škola, kterou studuje'), + ), + migrations.AddField( + model_name='organizator', + name='vytvoreno', + field=models.DateTimeField(blank=True, default=django.utils.timezone.now, editable=False, verbose_name='Vytvořeno'), + ), + migrations.AddField( + model_name='problem', + name='garant', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='garant_problemu_problem', to='seminar.Organizator', verbose_name='garant zadaného problému'), + ), + migrations.AddField( + model_name='problem', + name='nadproblem', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='nadproblem_problem', to='seminar.Problem', verbose_name='nadřazený problém'), + ), + migrations.AddField( + model_name='problem', + name='opravovatele', + field=models.ManyToManyField(blank=True, related_name='opravovatele_problem', to='seminar.Organizator', verbose_name='opravovatelé'), + ), + migrations.AddField( + model_name='reseni', + name='zverejneno', + field=models.BooleanField(default=False, help_text='Udává, zda je řešení zveřejněno', verbose_name='řešení zveřejněno'), + ), + 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\t není výsledkovka zatím veřejná.', verbose_name='zveřejněna výsledkovka'), + ), + migrations.AlterField( + model_name='cislo', + name='verejne_db', + field=models.BooleanField(db_column='verejne', default=False, verbose_name='číslo zveřejněno'), + ), + migrations.AlterField( + model_name='konfera', + name='typ_prezentace', + field=models.CharField(choices=[('veletrh', 'Veletrh (postery)'), ('prezentace', 'Prezentace (přednáška)')], default='veletrh', max_length=16, verbose_name='typ prezentace'), + ), + migrations.RenameField( + model_name='novinky', + old_name='autor', + new_name='autor_old', + ), + migrations.AddField( + model_name='novinky', + name='autor', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='seminar.Organizator', verbose_name='Autor novinky'), + ), + migrations.AlterField( + model_name='novinky', + name='obrazek', + field=models.ImageField(blank=True, null=True, upload_to='image_novinky/%Y/%m/%d/', verbose_name='Obrázek'), + ), + migrations.AlterField( + model_name='novinky', + name='text', + field=models.TextField(blank=True, null=True, verbose_name='Text novinky'), + ), + migrations.AlterField( + model_name='novinky', + name='zverejneno', + field=models.BooleanField(default=False, verbose_name='Zveřejněno'), + ), + migrations.AlterField( + model_name='organizator', + name='strucny_popis_organizatora', + field=models.TextField(blank=True, null=True, verbose_name='Stručný popis organizátora'), + ), + migrations.AlterField( + model_name='organizator', + name='studuje', + field=models.CharField(blank=True, help_text="Např. 'Studuje Obecnou fyziku (Bc.), 3. ročník', 'Vystudovala Diskrétní modely a algoritmy (Mgr.)' nebo 'Přednáší na MFF'", max_length=256, null=True, verbose_name='Studium aj.'), + ), + migrations.CreateModel( + name='Pohadka', + fields=[ + ('id', models.AutoField(primary_key=True, serialize=False)), + ('text', models.TextField(verbose_name='Text pohádky')), + ('pred', models.BooleanField(default=True, verbose_name='Před úlohou')), + ('vytvoreno', models.DateTimeField(blank=True, default=django.utils.timezone.now, editable=False, verbose_name='Vytvořeno')), + ('autor_old', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name=b'Autor poh\xc3\xa1dky')), + ('uloha_old', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='pohadky', to='seminar.Problem', verbose_name='Úloha')), + ('autor', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='seminar.Organizator', verbose_name='Autor pohádky')), + ('uloha', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='pohadky', to='seminar.Uloha', verbose_name='Úloha')), + ], + options={ + 'ordering': ['uloha__cislo_zadani', 'uloha__kod', '-pred'], + 'db_table': 'seminar_pohadky', + 'verbose_name': 'Pohádka', + 'verbose_name_plural': 'Pohádky', + }, + ), + migrations.RenameField( + model_name='problem', + old_name='autor', + new_name='autor_old', + ), + migrations.AddField( + model_name='problem', + name='autor', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='autor_problemu_problem', to='seminar.Organizator', verbose_name='autor problému'), + ), + migrations.AlterField( + model_name='problem', + name='kod', + field=models.CharField(blank=True, default='', help_text='Číslo/kód úlohy v čísle nebo kód tématu/článku/seriálu v ročníku', max_length=32, verbose_name='lokální kód'), + ), + migrations.AlterField( + model_name='problem', + name='stav', + field=models.CharField(choices=[('navrh', 'Návrh'), ('zadany', 'Zadaný'), ('vyreseny', 'Vyřešený'), ('smazany', 'Smazaný')], default='navrh', max_length=32, verbose_name='stav problému'), + ), + migrations.AlterField( + model_name='problem', + name='zamereni', + field=taggit.managers.TaggableManager(blank=True, help_text='Zaměření M/F/I/O problému, příp. další tagy', through='taggit.TaggedItem', to='taggit.Tag', verbose_name='zaměření'), + ), + migrations.AlterField( + model_name='reseni', + name='forma', + field=models.CharField(choices=[('papir', 'Papírové řešení'), ('email', 'Emailem'), ('upload', 'Upload přes web')], default='email', max_length=16, verbose_name='forma řešení'), + ), + migrations.RenameField( + model_name='reseni', + old_name='problem', + new_name='problem_old', + ), + migrations.AlterField( + model_name='resitel', + name='zasilat', + field=models.CharField(choices=[('domu', 'Domů'), ('do_skoly', 'Do školy'), ('nikam', 'Nikam')], default='domu', max_length=32, verbose_name='kam zasílat'), + ), + migrations.AlterField( + model_name='rocnik', + name='exportovat', + field=models.BooleanField(db_column='exportovat', default=False, help_text='Exportuje se jen podle tohoto flagu (ne veřejnosti), a to jen čísla s veřejnou výsledkovkou', verbose_name='export do AESOPa'), + ), + migrations.AlterField( + model_name='skola', + name='aesop_id', + field=models.CharField(blank=True, default='', help_text='Aesopi ID typu "izo:..." nebo "aesop:..."', max_length=32, verbose_name='Aesop ID'), + ), + migrations.AlterField( + model_name='skola', + name='kratky_nazev', + field=models.CharField(blank=True, help_text='Zkrácený název pro zobrazení ve výsledkovce', max_length=256, verbose_name='zkrácený název'), + ), + migrations.AlterField( + model_name='skola', + name='stat', + field=django_countries.fields.CountryField(default='CZ', help_text='ISO 3166-1 kód země velkými písmeny (CZ, SK, ...)', max_length=2, verbose_name='stát'), + ), + migrations.AlterField( + model_name='soustredeni', + name='exportovat', + field=models.BooleanField(db_column='exportovat', default=False, help_text='Exportuje se jen podle tohoto flagu (ne veřejnosti)', verbose_name='export do AESOPa'), + ), + migrations.AlterField( + model_name='soustredeni', + name='misto', + field=models.CharField(blank=True, default='', help_text='Místo (název obce, volitelně též objektu', max_length=256, verbose_name='místo soustředění'), + ), + migrations.AlterField( + model_name='soustredeni', + name='text', + field=models.TextField(blank=True, default='', verbose_name='text k soustředění (HTML)'), + ), + migrations.AlterField( + model_name='soustredeni', + name='typ', + field=models.CharField(choices=[('jarni', 'Jarní soustředění'), ('podzimni', 'Podzimní soustředění'), ('vikend', 'Víkendový sraz')], default='podzimni', max_length=16, verbose_name='typ akce'), + ), + migrations.AlterField( + model_name='soustredeni', + name='verejne_db', + field=models.BooleanField(db_column='verejne', default=False, verbose_name='soustředění zveřejněno'), + ), + migrations.AlterModelTable( + name='problem', + table='seminar_problemy', + ), + migrations.AddField( + model_name='uloha', + name='cislo_deadline', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='deadlinove_ulohy', to='seminar.Cislo', verbose_name='číslo deadlinu'), + ), + migrations.AddField( + model_name='uloha', + name='cislo_reseni', + field=models.ForeignKey(blank=True, help_text='Číslo s řešením úlohy, jen pro úlohy', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='resene_ulohy', to='seminar.Cislo', verbose_name='číslo řešení'), + ), + migrations.AddField( + model_name='uloha', + name='cislo_zadani', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='zadane_ulohy', to='seminar.Cislo', verbose_name='číslo zadání'), + ), + migrations.CreateModel( + name='Tema', + fields=[ + ('problem_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='seminar.Problem')), + ('tema_typ', models.CharField(choices=[('tema', 'Téma'), ('serial', 'Seriál')], default='tema', max_length=16, verbose_name='Typ tématu')), + ('rocnik', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='seminar.Rocnik', verbose_name='ročník')), + ], + options={ + 'verbose_name': 'Téma', + 'verbose_name_plural': 'Témata', + 'db_table': 'seminar_temata', + }, + bases=('seminar.problem',), + ), + migrations.CreateModel( + name='Reseni_Resitele', + fields=[ + ('id', models.AutoField(primary_key=True, serialize=False)), + ('reseni', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='seminar.Reseni', verbose_name='řešení')), + ('resitele', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='seminar.Resitel', verbose_name='řešitel')), + ], + options={ + 'verbose_name': 'Řešení řešitelů', + 'verbose_name_plural': 'Řešení řešitelů', + 'db_table': 'seminar_reseni_resitele', + 'ordering': ['reseni', 'resitele'], + }, + ), + migrations.CreateModel( + name='Obrazek', + fields=[ + ('id', models.AutoField(primary_key=True, serialize=False)), + ('na_web', models.ImageField(blank=True, null=True, upload_to='obrazky/%Y/%m/%d/', verbose_name='obrázek na web')), + ('do_cisla_barevny', models.FileField(blank=True, help_text='Barevná verze obrázku do čísla', null=True, upload_to='obrazky/%Y/%m/%d/', verbose_name='barevný obrázek do čísla')), + ('do_cisla_cernobily', models.FileField(blank=True, help_text='Černobílá verze obrázku do čísla', null=True, upload_to='obrazky/%Y/%m/%d/', verbose_name='černobílý obrázek do čísla')), + ('text', models.ForeignKey(help_text='text, ve kterém se obrázek vyskytuje', on_delete=django.db.models.deletion.CASCADE, to='seminar.Text', verbose_name='text')), + ], + options={ + 'verbose_name': 'obrázek', + 'verbose_name_plural': 'obrázky', + 'db_table': 'seminar_obrazky', + }, + ), + migrations.CreateModel( + name='Hodnoceni', + fields=[ + ('id', models.AutoField(primary_key=True, serialize=False)), + ('body', models.DecimalField(decimal_places=1, max_digits=8, verbose_name='body')), + ('cislo_body', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='hodnoceni', to='seminar.Cislo', verbose_name='číslo pro body')), + ('problem', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='seminar.Problem', verbose_name='problém')), + ('reseni', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='seminar.Reseni', verbose_name='řešení')), + ], + options={ + 'verbose_name': 'Hodnocení', + 'verbose_name_plural': 'Hodnocení', + 'db_table': 'seminar_hodnoceni', + }, + ), + migrations.CreateModel( + name='Clanek', + fields=[ + ('problem_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='seminar.Problem')), + ('cislo', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='seminar.Cislo', verbose_name='číslo')), + ], + options={ + 'verbose_name': 'Článek', + 'verbose_name_plural': 'Články', + 'db_table': 'seminar_clanky', + }, + bases=('seminar.problem',), + ), + migrations.AddField( + model_name='reseni', + name='resitele', + field=models.ManyToManyField(help_text='Seznam autorů řešení', through='seminar.Reseni_Resitele', to='seminar.Resitel', verbose_name='autoři řešení'), + ), + migrations.AddField( + model_name='reseni', + name='text_cely', + field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='reseni_cely_set', to='seminar.Text', verbose_name='Plná verze textu řešení'), + ), + migrations.AddField( + model_name='reseni', + name='text_zkraceny', + field=models.ManyToManyField(help_text='Seznam úryvků z řešení', related_name='reseni_zkraceny_set', to='seminar.Text', verbose_name='zkrácené verze řešení'), + ), + migrations.AddField( + model_name='skola', + name='kontaktni_osoba', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='seminar.Osoba', verbose_name='Kontaktní osoba'), + ), + migrations.AddField( + model_name='reseni', + name='problem', + field=models.ManyToManyField(help_text='Problém', through='seminar.Hodnoceni', to='seminar.Problem', verbose_name='problém'), + ), + migrations.AddField( + model_name='konfera', + name='reseni', + field=models.OneToOneField(blank=True, help_text='Účastnický přípěvek o konfeře', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='konfery', to='seminar.Reseni', verbose_name='článek ke konfeře'), + ), + migrations.AddField( + model_name='organizator', + name='osoba', + field=models.OneToOneField(help_text='osobní údaje organizátora', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='org', to='seminar.Osoba', verbose_name='osoba'), + ), + migrations.AddField( + model_name='resitel', + name='osoba', + field=models.OneToOneField(null=True, on_delete=django.db.models.deletion.CASCADE, to='seminar.Osoba', verbose_name='osoba'), + ), + migrations.CreateModel( + name='TreeNode', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('first_child', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='seminar.TreeNode', verbose_name='první potomek')), + ('root', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='potomci_set', to='seminar.TreeNode', verbose_name='kořen stromu')), + ('succ', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='prev', to='seminar.TreeNode', verbose_name='další element na stejné úrovni')), + ], + options={ + 'verbose_name': 'TreeNode', + 'verbose_name_plural': 'TreeNody', + 'db_table': 'seminar_nodes_treenode', + }, + ), + migrations.CreateModel( + name='CisloNode', + fields=[ + ('treenode_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='seminar.TreeNode')), + ('cislo', models.OneToOneField(on_delete=django.db.models.deletion.PROTECT, to='seminar.Cislo', verbose_name='číslo')), + ], + options={ + 'verbose_name': 'Číslo (Node)', + 'verbose_name_plural': 'Čísla (Node)', + 'db_table': 'seminar_nodes_cislo', + }, + bases=('seminar.treenode',), + ), + migrations.CreateModel( + name='ClanekNode', + fields=[ + ('treenode_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='seminar.TreeNode')), + ('clanek', models.OneToOneField(null=True, on_delete=django.db.models.deletion.PROTECT, to='seminar.Clanek', verbose_name='článek')), + ], + options={ + 'verbose_name': 'Článek (Node)', + 'verbose_name_plural': 'Články (Node)', + 'db_table': 'seminar_nodes_clanek', + }, + bases=('seminar.treenode',), + ), + migrations.CreateModel( + name='KonferaNode', + fields=[ + ('treenode_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='seminar.TreeNode')), + ('konfera', models.OneToOneField(null=True, on_delete=django.db.models.deletion.PROTECT, to='seminar.Konfera', verbose_name='konfera')), + ], + options={ + 'verbose_name': 'Konfera (Node)', + 'verbose_name_plural': 'Konfery (Node)', + 'db_table': 'seminar_nodes_konfera', + }, + bases=('seminar.treenode',), + ), + migrations.CreateModel( + name='MezicisloNode', + fields=[ + ('treenode_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='seminar.TreeNode')), + ], + options={ + 'verbose_name': 'Mezičíslo (Node)', + 'verbose_name_plural': 'Mezičísla (Node)', + 'db_table': 'seminar_nodes_mezicislo', + }, + bases=('seminar.treenode',), + ), + migrations.CreateModel( + name='RocnikNode', + fields=[ + ('treenode_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='seminar.TreeNode')), + ('rocnik', models.OneToOneField(on_delete=django.db.models.deletion.PROTECT, to='seminar.Rocnik', verbose_name='ročník')), + ], + options={ + 'verbose_name': 'Ročník (Node)', + 'verbose_name_plural': 'Ročníky (Node)', + 'db_table': 'seminar_nodes_rocnik', + }, + bases=('seminar.treenode',), + ), + migrations.CreateModel( + name='TemaVCisleNode', + fields=[ + ('treenode_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='seminar.TreeNode')), + ('tema', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Tema', verbose_name='téma v čísle')), + ], + options={ + 'verbose_name': 'Téma v čísle (Node)', + 'verbose_name_plural': 'Témata v čísle (Node)', + 'db_table': 'seminar_nodes_temavcisle', + }, + bases=('seminar.treenode',), + ), + migrations.CreateModel( + name='TextNode', + fields=[ + ('treenode_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='seminar.TreeNode')), + ('text', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Text', verbose_name='text')), + ], + options={ + 'verbose_name': 'Text (Node)', + 'verbose_name_plural': 'Text (Node)', + 'db_table': 'seminar_nodes_obsah', + }, + bases=('seminar.treenode',), + ), + migrations.CreateModel( + name='UlohaVzorakNode', + fields=[ + ('treenode_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='seminar.TreeNode')), + ('uloha', models.OneToOneField(null=True, on_delete=django.db.models.deletion.PROTECT, to='seminar.Uloha', verbose_name='úloha')), + ], + options={ + 'verbose_name': 'Vzorák úlohy (Node)', + 'verbose_name_plural': 'Vzoráky úloh (Node)', + 'db_table': 'seminar_nodes_uloha_vzorak', + }, + bases=('seminar.treenode',), + ), + migrations.CreateModel( + name='UlohaZadaniNode', + fields=[ + ('treenode_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='seminar.TreeNode')), + ('uloha', models.OneToOneField(null=True, on_delete=django.db.models.deletion.PROTECT, to='seminar.Uloha', verbose_name='úloha')), + ], + options={ + 'verbose_name': 'Zadání úlohy (Node)', + 'verbose_name_plural': 'Zadání úloh (Node)', + 'db_table': 'seminar_nodes_uloha_zadani', + }, + bases=('seminar.treenode',), + ), + migrations.CreateModel( + name='PohadkaNode', + fields=[ + ('treenode_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='seminar.TreeNode')), + ('pohadka', models.OneToOneField(on_delete=django.db.models.deletion.PROTECT, to='seminar.Pohadka', verbose_name='pohádka')), + ], + options={ + 'verbose_name': 'Pohádka (Node)', + 'verbose_name_plural': 'Pohádky (Node)', + 'db_table': 'seminar_nodes_pohadka', + }, + bases=('seminar.treenode',), + ), + + # migr 0051 + migrations.RunPython( + resitel_to_osoba, + reverse_code=osoba_to_resitel, + ), + + # migr 0052 + migrations.RunPython( + spoj_k_organizatorum_osoby, + ), + migrations.RunPython( + fix_problem, + ), + migrations.RunPython( + fix_pohadka, + ), + migrations.RunPython( + fix_novinka, + ), + + # migr 0053 + migrations.RunPython( + rok_to_datetime, + reverse_code=datetime_to_rok, + ), + + migrations.RemoveField( + model_name='prispevek', + name='problem', + ), + migrations.RemoveField( + model_name='prispevek', + name='reseni', + ), + migrations.DeleteModel( + name='ProblemNavrh', + ), + migrations.DeleteModel( + name='ProblemZadany', + ), + migrations.RemoveField( + model_name='cislo', + name='faze', + ), + migrations.RemoveField( + model_name='konfera', + name='popis', + ), + migrations.RemoveField( + model_name='konfera', + name='prispevek', + ), + migrations.RemoveField( + model_name='problem', + name='import_dakos_id', + ), + migrations.RemoveField( + model_name='resitel', + name='import_mamoper_id', + ), + migrations.RemoveField( + model_name='skola', + name='import_dakos_id', + ), + migrations.DeleteModel( + name='Prispevek', + ), + + # migr 0056 + migrations.RunPython( + generuj_RocnikNody_a_CisloNody, + ), + + # migr 0057 + migrations.RunPython( + reseni_to_Reseni, + ), + + # migr 0058 + migrations.RunPython( + uloha_to_Uloha, + ), + migrations.RunPython( + tema_to_Tema, + ), + migrations.RunPython( + clanek_to_Clanek, + ), + migrations.RunPython( + konfery_rucne, + ), + + # migr 0059 + migrations.RunPython( + vytvor_pohadkanode, + ), + + # migr 0060 + migrations.RunPython( + pokacej_les, + ), + + 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.AlterModelOptions( + name='pohadka', + options={'ordering': ['vytvoreno'], 'verbose_name': 'Pohádka', 'verbose_name_plural': 'Pohádky'}, + ), + migrations.RemoveField( + model_name='pohadka', + name='pred', + ), + migrations.RemoveField( + model_name='pohadka', + name='text', + ), + migrations.RemoveField( + model_name='pohadka', + name='uloha', + ), + migrations.AlterField( + model_name='cislo', + name='verejna_vysledkovka', + field=models.BooleanField(default=False, help_text='Je-li false u veřejného čísla, není výsledkovka zatím veřejná.', verbose_name='zveřejněna výsledkovka'), + ), + 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í'), + ), + migrations.AlterField( + model_name='cislo', + name='rocnik', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='cisla', to='seminar.Rocnik', verbose_name='ročník'), + ), + migrations.AlterField( + model_name='clanek', + name='cislo', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='seminar.Cislo', verbose_name='číslo'), + ), + migrations.AlterField( + model_name='hodnoceni', + name='cislo_body', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='hodnoceni', to='seminar.Cislo', verbose_name='číslo pro body'), + ), + migrations.AlterField( + model_name='hodnoceni', + name='problem', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Problem', verbose_name='problém'), + ), + migrations.AlterField( + model_name='konfery_ucastnici', + name='konfera', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='seminar.Konfera', verbose_name='konfera'), + ), + migrations.AlterField( + model_name='konfery_ucastnici', + name='resitel', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Resitel', verbose_name='řešitel'), + ), + migrations.AlterField( + model_name='nastaveni', + name='aktualni_cislo', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Cislo', verbose_name='poslední vydané číslo'), + ), + migrations.AlterField( + model_name='nastaveni', + name='aktualni_rocnik', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Rocnik', verbose_name='aktuální ročník'), + ), + migrations.AlterField( + model_name='novinky', + name='autor', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='seminar.Organizator', verbose_name='Autor novinky'), + ), + migrations.AlterField( + model_name='organizator', + name='osoba', + field=models.OneToOneField(help_text='osobní údaje organizátora', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='org', to='seminar.Osoba', verbose_name='osoba'), + ), + migrations.AlterField( + model_name='osoba', + name='user', + field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, to=settings.AUTH_USER_MODEL, verbose_name='uživatel'), + ), + migrations.AlterField( + model_name='pohadka', + name='autor', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='seminar.Organizator', verbose_name='Autor pohádky'), + ), + migrations.AlterField( + model_name='problem', + name='autor', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='autor_problemu_problem', to='seminar.Organizator', verbose_name='autor problému'), + ), + migrations.AlterField( + model_name='problem', + name='garant', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='garant_problemu_problem', to='seminar.Organizator', verbose_name='garant zadaného problému'), + ), + migrations.AlterField( + model_name='problem', + name='nadproblem', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='nadproblem_problem', to='seminar.Problem', verbose_name='nadřazený problém'), + ), + migrations.AlterField( + model_name='reseni', + name='text_cely', + field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='reseni_cely_set', to='seminar.Text', verbose_name='Plná verze textu řešení'), + ), + migrations.AlterField( + model_name='reseni_resitele', + name='resitele', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Resitel', verbose_name='řešitel'), + ), + migrations.AlterField( + model_name='resitel', + name='osoba', + field=models.OneToOneField(null=True, on_delete=django.db.models.deletion.SET_NULL, to='seminar.Osoba', verbose_name='osoba'), + ), + migrations.AlterField( + model_name='resitel', + name='skola', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='seminar.Skola', verbose_name='škola'), + ), + migrations.AlterField( + model_name='skola', + name='kontaktni_osoba', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='seminar.Osoba', verbose_name='Kontaktní osoba'), + ), + migrations.AlterField( + model_name='soustredeni', + name='rocnik', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='soustredeni', to='seminar.Rocnik', verbose_name='ročník'), + ), + migrations.AlterField( + model_name='soustredeni_organizatori', + name='organizator', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Organizator', verbose_name='organizátor'), + ), + migrations.AlterField( + model_name='soustredeni_organizatori', + name='soustredeni', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Soustredeni', verbose_name='soustředění'), + ), + migrations.AlterField( + model_name='soustredeni_ucastnici', + name='resitel', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Resitel', verbose_name='řešitel'), + ), + migrations.AlterField( + model_name='soustredeni_ucastnici', + name='soustredeni', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Soustredeni', verbose_name='soustředění'), + ), + migrations.AlterField( + model_name='tema', + name='rocnik', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='seminar.Rocnik', verbose_name='ročník'), + ), + migrations.AlterField( + model_name='uloha', + name='cislo_deadline', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='deadlinove_ulohy', to='seminar.Cislo', verbose_name='číslo deadlinu'), + ), + migrations.AlterField( + model_name='uloha', + name='cislo_reseni', + field=models.ForeignKey(blank=True, help_text='Číslo s řešením úlohy, jen pro úlohy', null=True, on_delete=django.db.models.deletion.PROTECT, related_name='resene_ulohy', to='seminar.Cislo', verbose_name='číslo řešení'), + ), + migrations.AlterField( + model_name='uloha', + name='cislo_zadani', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='zadane_ulohy', to='seminar.Cislo', verbose_name='číslo zadání'), + ), + migrations.AddField( + model_name='treenode', + name='polymorphic_ctype', + field=models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='polymorphic_seminar.treenode_set+', to='contenttypes.ContentType'), + ), + migrations.RunPython( + vyrob_treenodum_ctypes, + reverse_code=migrations.RunPython.noop, + ), + migrations.AddField( + model_name='problem', + name='polymorphic_ctype', + field=models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='polymorphic_seminar.problem_set+', to='contenttypes.ContentType'), + ), + migrations.RunPython( + vyrob_problemum_ctypes, + reverse_code=migrations.RunPython.noop, + ), + migrations.AlterField( + model_name='konfera', + name='nazev', + field=models.CharField(help_text='Název konfery', max_length=100, verbose_name='název konfery'), + ), + ] From 3815b5a8a879b7725f418ccde35ad2ec8fcac37a Mon Sep 17 00:00:00 2001 From: Pavel 'LEdoian' Turinsky Date: Thu, 7 Nov 2019 21:04:27 +0100 Subject: [PATCH 4/7] =?UTF-8?q?Zal=C3=A1man=C3=A9=20SQL,=20aby=20se=20dalo?= =?UTF-8?q?=20=C4=8D=C3=ADst?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../0001_squashed_0067_auto_20190814_0805.py | 148 +++++++++++++++++- 1 file changed, 143 insertions(+), 5 deletions(-) diff --git a/seminar/migrations/0001_squashed_0067_auto_20190814_0805.py b/seminar/migrations/0001_squashed_0067_auto_20190814_0805.py index f1f046af..3cc3be08 100644 --- a/seminar/migrations/0001_squashed_0067_auto_20190814_0805.py +++ b/seminar/migrations/0001_squashed_0067_auto_20190814_0805.py @@ -721,8 +721,35 @@ class Migration(migrations.Migration): field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='cisla', to='seminar.Rocnik', verbose_name='ročník'), ), migrations.RunSQL( - sql="\ncreate view seminar_body_za_cislo as\n select\n sr.cislo_body_id || '-' || sr.resitel_id as id,\n sr.cislo_body_id as cislo_id,\n sr.resitel_id as resitel_id,\n sum(sr.body) as body\n from seminar_reseni as sr\n group by sr.cislo_body_id, sr.resitel_id\n order by body desc;\n\ncreate view seminar_body_k_cislu as\n select\n akt_c.id || '-' || min_bzc.resitel_id as id,\n akt_c.id as cislo_id,\n min_bzc.resitel_id as resitel_id,\n max(akt_bzc.body) as body,\n sum(min_bzc.body) as body_celkem\n from ((seminar_cisla as akt_c\n inner join seminar_cisla as min_c on min_c.rocnik_id = akt_c.rocnik_id and akt_c.cislo >= min_c.cislo)\n inner join seminar_body_za_cislo as min_bzc on min_c.id = min_bzc.cislo_id)\n left outer join seminar_body_za_cislo as akt_bzc on akt_bzc.cislo_id = akt_c.id and akt_bzc.resitel_id = min_bzc.resitel_id \n group by akt_c.id, min_bzc.resitel_id, akt_bzc.resitel_id\n order by body_celkem desc;\n", - reverse_sql='\ndrop view seminar_body_k_cislu;\ndrop view seminar_body_za_cislo;\n', + sql=" + create view seminar_body_za_cislo as + select + sr.cislo_body_id || '-' || sr.resitel_id as id, + sr.cislo_body_id as cislo_id, + sr.resitel_id as resitel_id, + sum(sr.body) as body + from seminar_reseni as sr + group by sr.cislo_body_id, sr.resitel_id + order by body desc; + + create view seminar_body_k_cislu as + select + akt_c.id || '-' || min_bzc.resitel_id as id, + akt_c.id as cislo_id, + min_bzc.resitel_id as resitel_id, + max(akt_bzc.body) as body, + sum(min_bzc.body) as body_celkem + from ((seminar_cisla as akt_c + inner join seminar_cisla as min_c on min_c.rocnik_id = akt_c.rocnik_id and akt_c.cislo >= min_c.cislo) + inner join seminar_body_za_cislo as min_bzc on min_c.id = min_bzc.cislo_id) + left outer join seminar_body_za_cislo as akt_bzc on akt_bzc.cislo_id = akt_c.id and akt_bzc.resitel_id = min_bzc.resitel_id + group by akt_c.id, min_bzc.resitel_id, akt_bzc.resitel_id + order by body_celkem desc; + ", + reverse_sql=' + drop view seminar_body_k_cislu; + drop view seminar_body_za_cislo; + ', ), migrations.AlterField( model_name='reseni', @@ -956,7 +983,31 @@ class Migration(migrations.Migration): field=models.DecimalField(blank=True, decimal_places=1, max_digits=8, null=True, verbose_name='body'), ), migrations.RunSQL( - sql="\ncreate view seminar_body_za_cislo as\n select\n sr.cislo_body_id || '-' || sr.resitel_id as id,\n sr.cislo_body_id as cislo_id,\n sr.resitel_id as resitel_id,\n sum(sr.body) as body\n from seminar_reseni as sr\n group by sr.cislo_body_id, sr.resitel_id\n order by body desc;\n\ncreate view seminar_body_k_cislu as\n select\n akt_c.id || '-' || min_bzc.resitel_id as id,\n akt_c.id as cislo_id,\n min_bzc.resitel_id as resitel_id,\n max(akt_bzc.body) as body,\n sum(min_bzc.body) as body_celkem\n from ((seminar_cisla as akt_c\n inner join seminar_cisla as min_c on min_c.rocnik_id = akt_c.rocnik_id and akt_c.cislo >= min_c.cislo)\n inner join seminar_body_za_cislo as min_bzc on min_c.id = min_bzc.cislo_id)\n left outer join seminar_body_za_cislo as akt_bzc on akt_bzc.cislo_id = akt_c.id and akt_bzc.resitel_id = min_bzc.resitel_id \n group by akt_c.id, min_bzc.resitel_id, akt_bzc.resitel_id\n order by body_celkem desc;\n", + sql=" + create view seminar_body_za_cislo as + select + sr.cislo_body_id || '-' || sr.resitel_id as id, + sr.cislo_body_id as cislo_id, + sr.resitel_id as resitel_id, + sum(sr.body) as body + from seminar_reseni as sr + group by sr.cislo_body_id, sr.resitel_id + order by body desc; + + create view seminar_body_k_cislu as + select + akt_c.id || '-' || min_bzc.resitel_id as id, + akt_c.id as cislo_id, + min_bzc.resitel_id as resitel_id, + max(akt_bzc.body) as body, + sum(min_bzc.body) as body_celkem + from ((seminar_cisla as akt_c + inner join seminar_cisla as min_c on min_c.rocnik_id = akt_c.rocnik_id and akt_c.cislo >= min_c.cislo) + inner join seminar_body_za_cislo as min_bzc on min_c.id = min_bzc.cislo_id) + left outer join seminar_body_za_cislo as akt_bzc on akt_bzc.cislo_id = akt_c.id and akt_bzc.resitel_id = min_bzc.resitel_id + group by akt_c.id, min_bzc.resitel_id, akt_bzc.resitel_id + order by body_celkem desc; + ", ), migrations.CreateModel( name='Novinky', @@ -1007,10 +1058,97 @@ class Migration(migrations.Migration): field=models.CharField(choices=[(b'jarni', 'Jarní soustředění'), (b'podzimni', 'Podzimní soustředění'), (b'vikend', 'Víkendový sraz')], default=b'podzimni', max_length=16, verbose_name='typ akce'), ), migrations.RunSQL( - sql="\ndrop view seminar_body_k_cislu;\ndrop view seminar_body_za_cislo;\n\ncreate view seminar_body_za_cislo as\n select\n seminar_reseni.cislo_body_id || '-' || seminar_reseni.resitel_id as id,\n seminar_reseni.cislo_body_id as cislo_id,\n seminar_reseni.resitel_id as resitel_id,\n seminar_cisla.cislo as cislo,\n seminar_cisla.rocnik_id as rocnik_id,\n seminar_rocniky.rocnik as rocnik,\n seminar_cisla.verejna_vysledkovka as verejna_vysledkovka,\n sum(seminar_reseni.body) as body\n from\n seminar_reseni\n inner join seminar_cisla on seminar_reseni.cislo_body_id = seminar_cisla.id\n inner join seminar_rocniky on seminar_cisla.rocnik_id = seminar_rocniky.id\n group by seminar_reseni.cislo_body_id, seminar_reseni.resitel_id, seminar_cisla.cislo,\n seminar_cisla.rocnik_id, seminar_rocniky.rocnik, seminar_cisla.verejna_vysledkovka\n order by body desc;\n\ncreate view seminar_body_k_cislu_rocnik as\n select\n akt_body.id as id,\n akt_body.cislo_id as cislo_id,\n akt_body.resitel_id as resitel_id,\n akt_body.body as body,\n sum(min_body.body) as body_celkem\n from\n seminar_body_za_cislo as akt_body\n inner join seminar_body_za_cislo as min_body on\n (akt_body.resitel_id = min_body.resitel_id and\n (akt_body.rocnik = min_body.rocnik and akt_body.cislo >= min_body.cislo)\n )\n group by akt_body.id, akt_body.cislo_id, akt_body.resitel_id, akt_body.body\n order by body_celkem desc;\n\ncreate view seminar_body_k_cislu_odjakziva as\n select\n akt_body.id as id,\n akt_body.cislo_id as cislo_id,\n akt_body.resitel_id as resitel_id,\n akt_body.body as body,\n sum(min_body.body) as body_celkem\n from\n seminar_body_za_cislo as akt_body\n inner join seminar_body_za_cislo as min_body on\n (akt_body.resitel_id = min_body.resitel_id and\n ((akt_body.rocnik = min_body.rocnik and akt_body.cislo >= min_body.cislo) or\n (akt_body.rocnik < min_body.rocnik)\n )\n )\n group by akt_body.id, akt_body.cislo_id, akt_body.resitel_id, akt_body.body\n order by body_celkem desc;\n\n", + sql=" + drop view seminar_body_k_cislu; + drop view seminar_body_za_cislo; + + create view seminar_body_za_cislo as + select + seminar_reseni.cislo_body_id || '-' || seminar_reseni.resitel_id as id, + seminar_reseni.cislo_body_id as cislo_id, + seminar_reseni.resitel_id as resitel_id, + seminar_cisla.cislo as cislo, + seminar_cisla.rocnik_id as rocnik_id, + seminar_rocniky.rocnik as rocnik, + seminar_cisla.verejna_vysledkovka as verejna_vysledkovka, + sum(seminar_reseni.body) as body + from + seminar_reseni + inner join seminar_cisla on seminar_reseni.cislo_body_id = seminar_cisla.id + inner join seminar_rocniky on seminar_cisla.rocnik_id = seminar_rocniky.id + group by seminar_reseni.cislo_body_id, seminar_reseni.resitel_id, seminar_cisla.cislo, + seminar_cisla.rocnik_id, seminar_rocniky.rocnik, seminar_cisla.verejna_vysledkovka + order by body desc; + + create view seminar_body_k_cislu_rocnik as + select + akt_body.id as id, + akt_body.cislo_id as cislo_id, + akt_body.resitel_id as resitel_id, + akt_body.body as body, + sum(min_body.body) as body_celkem + from + seminar_body_za_cislo as akt_body + inner join seminar_body_za_cislo as min_body on + (akt_body.resitel_id = min_body.resitel_id and + (akt_body.rocnik = min_body.rocnik and akt_body.cislo >= min_body.cislo) + ) + group by akt_body.id, akt_body.cislo_id, akt_body.resitel_id, akt_body.body + order by body_celkem desc; + + create view seminar_body_k_cislu_odjakziva as + select + akt_body.id as id, + akt_body.cislo_id as cislo_id, + akt_body.resitel_id as resitel_id, + akt_body.body as body, + sum(min_body.body) as body_celkem + from + seminar_body_za_cislo as akt_body + inner join seminar_body_za_cislo as min_body on + (akt_body.resitel_id = min_body.resitel_id and + ((akt_body.rocnik = min_body.rocnik and akt_body.cislo >= min_body.cislo) or + (akt_body.rocnik < min_body.rocnik) + ) + ) + group by akt_body.id, akt_body.cislo_id, akt_body.resitel_id, akt_body.body + order by body_celkem desc; + + ", ), migrations.RunSQL( - sql="\n\ndrop view seminar_body_k_cislu_rocnik;\ncreate view seminar_body_k_cislu_rocnik as\n select\n seminar_cisla.id || '-' || min_body.resitel_id as id,\n seminar_cisla.id as cislo_id,\n min_body.resitel_id as resitel_id,\n sum(min_body.body) as body\n from\n seminar_cisla\n inner join seminar_body_za_cislo as min_body on\n (min_body.rocnik_id = seminar_cisla.rocnik_id and seminar_cisla.cislo >= min_body.cislo)\n group by seminar_cisla.id, min_body.resitel_id\n order by body desc;\n\ndrop view seminar_body_k_cislu_odjakziva;\ncreate view seminar_body_k_cislu_odjakziva as\n select\n seminar_cisla.id || '-' || min_body.resitel_id as id,\n seminar_cisla.id as cislo_id,\n min_body.resitel_id as resitel_id,\n sum(min_body.body) as body\n from\n seminar_cisla\n inner join seminar_rocniky on\n (seminar_cisla.rocnik_id = seminar_rocniky.id)\n inner join seminar_body_za_cislo as min_body on\n (min_body.rocnik_id = seminar_cisla.rocnik_id and seminar_cisla.cislo >= min_body.cislo) or\n (min_body.rocnik < seminar_rocniky.rocnik)\n group by seminar_cisla.id, min_body.resitel_id\n order by body desc;\n", + sql=" + drop view seminar_body_k_cislu_rocnik; + create view seminar_body_k_cislu_rocnik as + select + seminar_cisla.id || '-' || min_body.resitel_id as id, + seminar_cisla.id as cislo_id, + min_body.resitel_id as resitel_id, + sum(min_body.body) as body + from + seminar_cisla + inner join seminar_body_za_cislo as min_body on + (min_body.rocnik_id = seminar_cisla.rocnik_id and seminar_cisla.cislo >= min_body.cislo) + group by seminar_cisla.id, min_body.resitel_id + order by body desc; + + drop view seminar_body_k_cislu_odjakziva; + create view seminar_body_k_cislu_odjakziva as + select + seminar_cisla.id || '-' || min_body.resitel_id as id, + seminar_cisla.id as cislo_id, + min_body.resitel_id as resitel_id, + sum(min_body.body) as body + from + seminar_cisla + inner join seminar_rocniky on + (seminar_cisla.rocnik_id = seminar_rocniky.id) + inner join seminar_body_za_cislo as min_body on + (min_body.rocnik_id = seminar_cisla.rocnik_id and seminar_cisla.cislo >= min_body.cislo) or + (min_body.rocnik < seminar_rocniky.rocnik) + group by seminar_cisla.id, min_body.resitel_id + order by body desc; + ", ), migrations.CreateModel( name='VysledkyCelkemKCislu', From 6a93c1c7bb4aa0905bd93ab0c0197ef1c7924fa0 Mon Sep 17 00:00:00 2001 From: Pavel 'LEdoian' Turinsky Date: Thu, 7 Nov 2019 21:05:55 +0100 Subject: [PATCH 5/7] =?UTF-8?q?Smazal=20jsem=20v=C5=A1echy=20v=C3=BDsledky?= =?UTF-8?q?=20a=20mo=C5=BEn=C3=A1=20jsem=20to=20nerozbil?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../0001_squashed_0067_auto_20190814_0805.py | 216 ------------------ 1 file changed, 216 deletions(-) diff --git a/seminar/migrations/0001_squashed_0067_auto_20190814_0805.py b/seminar/migrations/0001_squashed_0067_auto_20190814_0805.py index 3cc3be08..c1dc0c09 100644 --- a/seminar/migrations/0001_squashed_0067_auto_20190814_0805.py +++ b/seminar/migrations/0001_squashed_0067_auto_20190814_0805.py @@ -516,31 +516,6 @@ class Migration(migrations.Migration): ] operations = [ - migrations.CreateModel( - name='VysledkyKCislu', - fields=[ - ('dummy_id', models.CharField(db_column='id', max_length=32, primary_key=True, serialize=False, verbose_name='dummy ID pro view')), - ('body', models.IntegerField(db_column='body', verbose_name='body za číslo')), - ('body_celkem', models.IntegerField(db_column='body_celkem', verbose_name='body celkem do čísla')), - ], - options={ - 'abstract': False, - 'db_table': 'seminar_body_k_cislu', - 'managed': False, - }, - ), - migrations.CreateModel( - name='VysledkyZaCislo', - fields=[ - ('dummy_id', models.CharField(db_column='id', max_length=32, primary_key=True, serialize=False, verbose_name='dummy ID pro view')), - ('body', models.IntegerField(db_column='body', verbose_name='body za číslo')), - ], - options={ - 'abstract': False, - 'db_table': 'seminar_body_za_cislo', - 'managed': False, - }, - ), migrations.CreateModel( name='Cislo', fields=[ @@ -720,37 +695,6 @@ class Migration(migrations.Migration): name='rocnik', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='cisla', to='seminar.Rocnik', verbose_name='ročník'), ), - migrations.RunSQL( - sql=" - create view seminar_body_za_cislo as - select - sr.cislo_body_id || '-' || sr.resitel_id as id, - sr.cislo_body_id as cislo_id, - sr.resitel_id as resitel_id, - sum(sr.body) as body - from seminar_reseni as sr - group by sr.cislo_body_id, sr.resitel_id - order by body desc; - - create view seminar_body_k_cislu as - select - akt_c.id || '-' || min_bzc.resitel_id as id, - akt_c.id as cislo_id, - min_bzc.resitel_id as resitel_id, - max(akt_bzc.body) as body, - sum(min_bzc.body) as body_celkem - from ((seminar_cisla as akt_c - inner join seminar_cisla as min_c on min_c.rocnik_id = akt_c.rocnik_id and akt_c.cislo >= min_c.cislo) - inner join seminar_body_za_cislo as min_bzc on min_c.id = min_bzc.cislo_id) - left outer join seminar_body_za_cislo as akt_bzc on akt_bzc.cislo_id = akt_c.id and akt_bzc.resitel_id = min_bzc.resitel_id - group by akt_c.id, min_bzc.resitel_id, akt_bzc.resitel_id - order by body_celkem desc; - ", - reverse_sql=' - drop view seminar_body_k_cislu; - drop view seminar_body_za_cislo; - ', - ), migrations.AlterField( model_name='reseni', name='poznamka', @@ -969,9 +913,6 @@ class Migration(migrations.Migration): name='verejna_vysledkovka', field=models.BooleanField(default=False, help_text='Je-li false u veřejného čísla, není výsledkovka zatím veřejná.', verbose_name='zveřejněna výsledkovka'), ), - migrations.RunSQL( - sql='\ndrop view seminar_body_k_cislu;\ndrop view seminar_body_za_cislo;\n', - ), migrations.AlterField( model_name='problem', name='body', @@ -982,33 +923,6 @@ class Migration(migrations.Migration): name='body', field=models.DecimalField(blank=True, decimal_places=1, max_digits=8, null=True, verbose_name='body'), ), - migrations.RunSQL( - sql=" - create view seminar_body_za_cislo as - select - sr.cislo_body_id || '-' || sr.resitel_id as id, - sr.cislo_body_id as cislo_id, - sr.resitel_id as resitel_id, - sum(sr.body) as body - from seminar_reseni as sr - group by sr.cislo_body_id, sr.resitel_id - order by body desc; - - create view seminar_body_k_cislu as - select - akt_c.id || '-' || min_bzc.resitel_id as id, - akt_c.id as cislo_id, - min_bzc.resitel_id as resitel_id, - max(akt_bzc.body) as body, - sum(min_bzc.body) as body_celkem - from ((seminar_cisla as akt_c - inner join seminar_cisla as min_c on min_c.rocnik_id = akt_c.rocnik_id and akt_c.cislo >= min_c.cislo) - inner join seminar_body_za_cislo as min_bzc on min_c.id = min_bzc.cislo_id) - left outer join seminar_body_za_cislo as akt_bzc on akt_bzc.cislo_id = akt_c.id and akt_bzc.resitel_id = min_bzc.resitel_id - group by akt_c.id, min_bzc.resitel_id, akt_bzc.resitel_id - order by body_celkem desc; - ", - ), migrations.CreateModel( name='Novinky', fields=[ @@ -1057,136 +971,6 @@ class Migration(migrations.Migration): name='typ', field=models.CharField(choices=[(b'jarni', 'Jarní soustředění'), (b'podzimni', 'Podzimní soustředění'), (b'vikend', 'Víkendový sraz')], default=b'podzimni', max_length=16, verbose_name='typ akce'), ), - migrations.RunSQL( - sql=" - drop view seminar_body_k_cislu; - drop view seminar_body_za_cislo; - - create view seminar_body_za_cislo as - select - seminar_reseni.cislo_body_id || '-' || seminar_reseni.resitel_id as id, - seminar_reseni.cislo_body_id as cislo_id, - seminar_reseni.resitel_id as resitel_id, - seminar_cisla.cislo as cislo, - seminar_cisla.rocnik_id as rocnik_id, - seminar_rocniky.rocnik as rocnik, - seminar_cisla.verejna_vysledkovka as verejna_vysledkovka, - sum(seminar_reseni.body) as body - from - seminar_reseni - inner join seminar_cisla on seminar_reseni.cislo_body_id = seminar_cisla.id - inner join seminar_rocniky on seminar_cisla.rocnik_id = seminar_rocniky.id - group by seminar_reseni.cislo_body_id, seminar_reseni.resitel_id, seminar_cisla.cislo, - seminar_cisla.rocnik_id, seminar_rocniky.rocnik, seminar_cisla.verejna_vysledkovka - order by body desc; - - create view seminar_body_k_cislu_rocnik as - select - akt_body.id as id, - akt_body.cislo_id as cislo_id, - akt_body.resitel_id as resitel_id, - akt_body.body as body, - sum(min_body.body) as body_celkem - from - seminar_body_za_cislo as akt_body - inner join seminar_body_za_cislo as min_body on - (akt_body.resitel_id = min_body.resitel_id and - (akt_body.rocnik = min_body.rocnik and akt_body.cislo >= min_body.cislo) - ) - group by akt_body.id, akt_body.cislo_id, akt_body.resitel_id, akt_body.body - order by body_celkem desc; - - create view seminar_body_k_cislu_odjakziva as - select - akt_body.id as id, - akt_body.cislo_id as cislo_id, - akt_body.resitel_id as resitel_id, - akt_body.body as body, - sum(min_body.body) as body_celkem - from - seminar_body_za_cislo as akt_body - inner join seminar_body_za_cislo as min_body on - (akt_body.resitel_id = min_body.resitel_id and - ((akt_body.rocnik = min_body.rocnik and akt_body.cislo >= min_body.cislo) or - (akt_body.rocnik < min_body.rocnik) - ) - ) - group by akt_body.id, akt_body.cislo_id, akt_body.resitel_id, akt_body.body - order by body_celkem desc; - - ", - ), - migrations.RunSQL( - sql=" - drop view seminar_body_k_cislu_rocnik; - create view seminar_body_k_cislu_rocnik as - select - seminar_cisla.id || '-' || min_body.resitel_id as id, - seminar_cisla.id as cislo_id, - min_body.resitel_id as resitel_id, - sum(min_body.body) as body - from - seminar_cisla - inner join seminar_body_za_cislo as min_body on - (min_body.rocnik_id = seminar_cisla.rocnik_id and seminar_cisla.cislo >= min_body.cislo) - group by seminar_cisla.id, min_body.resitel_id - order by body desc; - - drop view seminar_body_k_cislu_odjakziva; - create view seminar_body_k_cislu_odjakziva as - select - seminar_cisla.id || '-' || min_body.resitel_id as id, - seminar_cisla.id as cislo_id, - min_body.resitel_id as resitel_id, - sum(min_body.body) as body - from - seminar_cisla - inner join seminar_rocniky on - (seminar_cisla.rocnik_id = seminar_rocniky.id) - inner join seminar_body_za_cislo as min_body on - (min_body.rocnik_id = seminar_cisla.rocnik_id and seminar_cisla.cislo >= min_body.cislo) or - (min_body.rocnik < seminar_rocniky.rocnik) - group by seminar_cisla.id, min_body.resitel_id - order by body desc; - ", - ), - migrations.CreateModel( - name='VysledkyCelkemKCislu', - fields=[ - ('dummy_id', models.CharField(db_column=b'id', max_length=32, primary_key=True, serialize=False, verbose_name='dummy ID pro view')), - ('body', models.DecimalField(db_column=b'body', decimal_places=1, max_digits=8, verbose_name='body za číslo')), - ('body_celkem', models.DecimalField(db_column=b'body_celkem', decimal_places=1, max_digits=8, verbose_name='body celkem do čísla včetně minulých ročníků')), - ], - options={ - 'abstract': False, - 'db_table': 'seminar_body_celkem_k_cislu', - 'managed': False, - }, - ), - migrations.CreateModel( - name='VysledkyKCisluOdjakziva', - fields=[ - ('dummy_id', models.CharField(db_column=b'id', max_length=32, primary_key=True, serialize=False, verbose_name='dummy ID pro view')), - ('body', models.DecimalField(db_column=b'body', decimal_places=1, max_digits=8, verbose_name='body za číslo')), - ], - options={ - 'abstract': False, - 'db_table': 'seminar_body_k_cislu_odjakziva', - 'managed': False, - }, - ), - migrations.CreateModel( - name='VysledkyKCisluZaRocnik', - fields=[ - ('dummy_id', models.CharField(db_column=b'id', max_length=32, primary_key=True, serialize=False, verbose_name='dummy ID pro view')), - ('body', models.DecimalField(db_column=b'body', decimal_places=1, max_digits=8, verbose_name='body za číslo')), - ], - options={ - 'abstract': False, - 'db_table': 'seminar_body_k_cislu_rocnik', - 'managed': False, - }, - ), migrations.AlterField( model_name='organizator', name='foto', From df4ae39a3f0ed098a81b0afeaaf83db78bf92b2e Mon Sep 17 00:00:00 2001 From: Pavel 'LEdoian' Turinsky Date: Thu, 7 Nov 2019 21:16:29 +0100 Subject: [PATCH 6/7] =?UTF-8?q?Django=20hraje=20squash=20=C5=A1patn=C4=9B,?= =?UTF-8?q?=20zapom=C3=ADn=C3=A1=20importovat?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seminar/migrations/0001_squashed_0067_auto_20190814_0805.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/seminar/migrations/0001_squashed_0067_auto_20190814_0805.py b/seminar/migrations/0001_squashed_0067_auto_20190814_0805.py index c1dc0c09..287be0f1 100644 --- a/seminar/migrations/0001_squashed_0067_auto_20190814_0805.py +++ b/seminar/migrations/0001_squashed_0067_auto_20190814_0805.py @@ -10,6 +10,12 @@ import imagekit.models.fields import seminar.models import taggit.managers +# migr 0053 +import datetime as dt + +# migr 0058 +from django.db.models import Q + # Functions from the following migrations need manual copying. # Move them and any dependencies into this file, then update the From 783c01c4b8fcd2e0dfb18d72576ec53a5b55993d Mon Sep 17 00:00:00 2001 From: Pavel 'LEdoian' Turinsky Date: Thu, 7 Nov 2019 21:50:16 +0100 Subject: [PATCH 7/7] =?UTF-8?q?Revert=20"Migrace:=20Semin=C3=A1=C5=99ov?= =?UTF-8?q?=C3=A9=20migrace=20t=C3=ADmto=20resetov=C3=A1ny"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit d5860e532e9c024c558cc88f87d5a6fb7b31d7cc. --- galerie/migrations/0001_initial.py | 2 +- .../0010_Pridani_odkazu_na_organizatora.py | 2 +- korektury/migrations/0014_add_org_to_pdf.py | 2 +- prednasky/migrations/0001_initial.py | 2 +- .../migrations/0005_auto_20160929_0153.py | 2 +- seminar/migrations/0001_initial.py | 251 +++++++ seminar/migrations/0001_reset.py | 670 ------------------ seminar/migrations/0002_add_body_views.py | 48 ++ seminar/migrations/0003_add_skola_zs_ss.py | 32 + seminar/migrations/0004_add_old_dakos_id.py | 44 ++ .../migrations/0005_alter_problem_autor.py | 21 + .../migrations/0006_problem_add_timestamp.py | 28 + seminar/migrations/0007_problem_zamereni.py | 22 + seminar/migrations/0008_reseni_forma.py | 20 + .../migrations/0009_rename_imported_IDs.py | 47 ++ seminar/migrations/0010_alter_rok_maturity.py | 20 + .../migrations/0011_alter_timestamp_def.py | 39 + .../0012_remove_soustredeni_ucastnici.py | 18 + ...013_soustredeni_ucastnici_through_model.py | 36 + seminar/migrations/0014_uprava_poznamek.py | 50 ++ seminar/migrations/0015_soustredeni_text.py | 20 + seminar/migrations/0016_texty_problemu.py | 42 ++ .../migrations/0017_texty_problemu_minor.py | 20 + .../0018_problemnavrh_problemzadany.py | 36 + seminar/migrations/0019_rocnik_ciselne.py | 32 + seminar/migrations/0020_indexy_a_razeni.py | 44 ++ .../0021_cislo_verejna_vysledkovka.py | 20 + seminar/migrations/0022_decimal_body.py | 29 + seminar/migrations/0023_add_novinky.py | 32 + seminar/migrations/0024_add_organizator.py | 35 + .../0025_zmena_cesty_nahravani_obrazku.py | 20 + seminar/migrations/0026_soustredeni_typ.py | 20 + .../migrations/0027_export_flag_a_typ_akce.py | 32 + .../migrations/0028_add_body_celkem_views.py | 75 ++ .../migrations/0029_fix_body_celkem_views.py | 51 ++ seminar/migrations/0030_add_vysledky.py | 60 ++ seminar/migrations/0031_cislo_pdf.py | 21 + .../migrations/0032_cislo_pdf_blank_typos.py | 44 ++ .../0033_organizator_studuje_popisek.py | 20 + .../0034_reseni_forma_default_email.py | 20 + seminar/migrations/0035_django_imagekit.py | 25 + .../migrations/0036_add_org_to_soustredeni.py | 36 + seminar/migrations/0037_prispevek.py | 29 + .../migrations/0038_change_meta_prispevek.py | 18 + seminar/migrations/0039_pohadka.py | 34 + .../0040_pohadka_nepovinny_autor.py | 20 + seminar/migrations/0041_konfery.py | 71 ++ seminar/migrations/0042_auto_20161005_0847.py | 31 + seminar/migrations/0042_cislo_faze.py | 19 + seminar/migrations/0043_uprava_faze.py | 19 + seminar/migrations/0044_uprava_faze.py | 19 + .../0045_cislo_pridani_faze_nahrano.py | 19 + seminar/migrations/0046_merge.py | 15 + seminar/migrations/0047_auto_20170120_2118.py | 19 + ...48_add_cislo_datum_deadline_soustredeni.py | 19 + seminar/migrations/0049_auto_20190430_2354.py | 508 +++++++++++++ seminar/migrations/0050_auto_20190510_2228.py | 191 +++++ seminar/migrations/0051_resitel_to_osoba.py | 89 +++ .../migrations/0052_user_to_organizator.py | 82 +++ .../0053_organizator_organizuje_od_do.py | 36 + .../0055_smazat_nemigrovane_zastarale_veci.py | 56 ++ .../0056_vrcholy_pro_rocniky_a_cisla.py | 47 ++ .../0057_reseni_to_reseni_hodnoceni.py | 34 + .../0058_problem_to_uloha_tema_clanek.py | 161 +++++ .../migrations/0059_vytvorit_pohadkanode.py | 29 + seminar/migrations/0060_spoj_stromy.py | 112 +++ seminar/migrations/0061_kill_frankenstein.py | 153 ++++ .../migrations/0062_redukce_modelu_pohadky.py | 33 + seminar/migrations/0063_procisteni_migraci.py | 35 + seminar/migrations/0064_auto_20190610_2358.py | 162 +++++ .../0065_treenode_polymorphic_ctype.py | 31 + .../0066_problem_polymorphic_ctype.py | 29 + seminar/migrations/0067_auto_20190814_0805.py | 18 + 73 files changed, 3553 insertions(+), 675 deletions(-) create mode 100644 seminar/migrations/0001_initial.py delete mode 100644 seminar/migrations/0001_reset.py create mode 100644 seminar/migrations/0002_add_body_views.py create mode 100644 seminar/migrations/0003_add_skola_zs_ss.py create mode 100644 seminar/migrations/0004_add_old_dakos_id.py create mode 100644 seminar/migrations/0005_alter_problem_autor.py create mode 100644 seminar/migrations/0006_problem_add_timestamp.py create mode 100644 seminar/migrations/0007_problem_zamereni.py create mode 100644 seminar/migrations/0008_reseni_forma.py create mode 100644 seminar/migrations/0009_rename_imported_IDs.py create mode 100644 seminar/migrations/0010_alter_rok_maturity.py create mode 100644 seminar/migrations/0011_alter_timestamp_def.py create mode 100644 seminar/migrations/0012_remove_soustredeni_ucastnici.py create mode 100644 seminar/migrations/0013_soustredeni_ucastnici_through_model.py create mode 100644 seminar/migrations/0014_uprava_poznamek.py create mode 100644 seminar/migrations/0015_soustredeni_text.py create mode 100644 seminar/migrations/0016_texty_problemu.py create mode 100644 seminar/migrations/0017_texty_problemu_minor.py create mode 100644 seminar/migrations/0018_problemnavrh_problemzadany.py create mode 100644 seminar/migrations/0019_rocnik_ciselne.py create mode 100644 seminar/migrations/0020_indexy_a_razeni.py create mode 100644 seminar/migrations/0021_cislo_verejna_vysledkovka.py create mode 100644 seminar/migrations/0022_decimal_body.py create mode 100644 seminar/migrations/0023_add_novinky.py create mode 100644 seminar/migrations/0024_add_organizator.py create mode 100644 seminar/migrations/0025_zmena_cesty_nahravani_obrazku.py create mode 100644 seminar/migrations/0026_soustredeni_typ.py create mode 100644 seminar/migrations/0027_export_flag_a_typ_akce.py create mode 100644 seminar/migrations/0028_add_body_celkem_views.py create mode 100644 seminar/migrations/0029_fix_body_celkem_views.py create mode 100644 seminar/migrations/0030_add_vysledky.py create mode 100644 seminar/migrations/0031_cislo_pdf.py create mode 100644 seminar/migrations/0032_cislo_pdf_blank_typos.py create mode 100644 seminar/migrations/0033_organizator_studuje_popisek.py create mode 100644 seminar/migrations/0034_reseni_forma_default_email.py create mode 100644 seminar/migrations/0035_django_imagekit.py create mode 100644 seminar/migrations/0036_add_org_to_soustredeni.py create mode 100644 seminar/migrations/0037_prispevek.py create mode 100644 seminar/migrations/0038_change_meta_prispevek.py create mode 100644 seminar/migrations/0039_pohadka.py create mode 100644 seminar/migrations/0040_pohadka_nepovinny_autor.py create mode 100644 seminar/migrations/0041_konfery.py create mode 100644 seminar/migrations/0042_auto_20161005_0847.py create mode 100644 seminar/migrations/0042_cislo_faze.py create mode 100644 seminar/migrations/0043_uprava_faze.py create mode 100644 seminar/migrations/0044_uprava_faze.py create mode 100644 seminar/migrations/0045_cislo_pridani_faze_nahrano.py create mode 100644 seminar/migrations/0046_merge.py create mode 100644 seminar/migrations/0047_auto_20170120_2118.py create mode 100644 seminar/migrations/0048_add_cislo_datum_deadline_soustredeni.py create mode 100644 seminar/migrations/0049_auto_20190430_2354.py create mode 100644 seminar/migrations/0050_auto_20190510_2228.py create mode 100644 seminar/migrations/0051_resitel_to_osoba.py create mode 100644 seminar/migrations/0052_user_to_organizator.py create mode 100644 seminar/migrations/0053_organizator_organizuje_od_do.py create mode 100644 seminar/migrations/0055_smazat_nemigrovane_zastarale_veci.py create mode 100644 seminar/migrations/0056_vrcholy_pro_rocniky_a_cisla.py create mode 100644 seminar/migrations/0057_reseni_to_reseni_hodnoceni.py create mode 100644 seminar/migrations/0058_problem_to_uloha_tema_clanek.py create mode 100644 seminar/migrations/0059_vytvorit_pohadkanode.py create mode 100644 seminar/migrations/0060_spoj_stromy.py create mode 100644 seminar/migrations/0061_kill_frankenstein.py create mode 100644 seminar/migrations/0062_redukce_modelu_pohadky.py create mode 100644 seminar/migrations/0063_procisteni_migraci.py create mode 100644 seminar/migrations/0064_auto_20190610_2358.py create mode 100644 seminar/migrations/0065_treenode_polymorphic_ctype.py create mode 100644 seminar/migrations/0066_problem_polymorphic_ctype.py create mode 100644 seminar/migrations/0067_auto_20190814_0805.py diff --git a/galerie/migrations/0001_initial.py b/galerie/migrations/0001_initial.py index 23de992b..21701185 100644 --- a/galerie/migrations/0001_initial.py +++ b/galerie/migrations/0001_initial.py @@ -8,7 +8,7 @@ import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ - ('seminar', '0001_reset'), + ('seminar', '0033_organizator_studuje_popisek'), ] operations = [ diff --git a/korektury/migrations/0010_Pridani_odkazu_na_organizatora.py b/korektury/migrations/0010_Pridani_odkazu_na_organizatora.py index a0579b4a..6b318cab 100644 --- a/korektury/migrations/0010_Pridani_odkazu_na_organizatora.py +++ b/korektury/migrations/0010_Pridani_odkazu_na_organizatora.py @@ -7,7 +7,7 @@ from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ - ('seminar', '0001_reset'), + ('seminar', '0041_konfery'), ('korektury', '0009_trizeni_korektur_v_seznamu'), ] diff --git a/korektury/migrations/0014_add_org_to_pdf.py b/korektury/migrations/0014_add_org_to_pdf.py index 33cedd0d..afd939ba 100644 --- a/korektury/migrations/0014_add_org_to_pdf.py +++ b/korektury/migrations/0014_add_org_to_pdf.py @@ -7,7 +7,7 @@ from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ - ('seminar', '0001_reset'), + ('seminar', '0041_konfery'), ('korektury', '0013_rename_autor_org'), ] diff --git a/prednasky/migrations/0001_initial.py b/prednasky/migrations/0001_initial.py index 80f33bc9..07da4a4e 100644 --- a/prednasky/migrations/0001_initial.py +++ b/prednasky/migrations/0001_initial.py @@ -7,7 +7,7 @@ from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ - ('seminar', '0001_reset'), + ('seminar', '0036_add_org_to_soustredeni'), ] operations = [ diff --git a/prednasky/migrations/0005_auto_20160929_0153.py b/prednasky/migrations/0005_auto_20160929_0153.py index b67625d0..7ecff0a0 100644 --- a/prednasky/migrations/0005_auto_20160929_0153.py +++ b/prednasky/migrations/0005_auto_20160929_0153.py @@ -7,7 +7,7 @@ from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ - ('seminar', '0001_reset'), + ('seminar', '0041_konfery'), ('prednasky', '0004_remove_prednaska_seznam'), ] diff --git a/seminar/migrations/0001_initial.py b/seminar/migrations/0001_initial.py new file mode 100644 index 00000000..088193b3 --- /dev/null +++ b/seminar/migrations/0001_initial.py @@ -0,0 +1,251 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +import django_countries.fields +import seminar.models +import django.utils.timezone +from django.conf import settings + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.CreateModel( + name='VysledkyKCislu', + fields=[ + ('dummy_id', models.CharField(max_length=32, serialize=False, verbose_name='dummy ID pro view', primary_key=True, db_column='id')), + ('body', models.IntegerField(verbose_name='body za \u010d\xedslo', db_column='body')), + ('body_celkem', models.IntegerField(verbose_name='body celkem do \u010d\xedsla', db_column='body_celkem')), + ], + options={ + 'abstract': False, + 'db_table': 'seminar_body_k_cislu', + 'managed': False, + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='VysledkyZaCislo', + fields=[ + ('dummy_id', models.CharField(max_length=32, serialize=False, verbose_name='dummy ID pro view', primary_key=True, db_column='id')), + ('body', models.IntegerField(verbose_name='body za \u010d\xedslo', db_column='body')), + ], + options={ + 'abstract': False, + 'db_table': 'seminar_body_za_cislo', + 'managed': False, + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='Cislo', + fields=[ + ('id', models.AutoField(serialize=False, primary_key=True)), + ('cislo', models.CharField(help_text='V\u011bt\u0161inou jen "1", vyj\xedme\u010dn\u011b "7-8", lexikograficky ur\u010dije po\u0159ad\xed v ro\u010dn\xedku!', max_length=32, verbose_name='n\xe1zev \u010d\xedsla')), + ('datum_vydani', models.DateField(help_text='Datum vyd\xe1n\xed fin\xe1ln\xed verze', null=True, verbose_name='datum vyd\xe1n\xed', blank=True)), + ('datum_deadline', models.DateField(help_text='Datum pro p\u0159\xedjem \u0159e\u0161en\xed \xfaloh zadan\xfdch v tomto \u010d\xedsle', null=True, verbose_name='datum deadline', blank=True)), + ('verejne_db', models.BooleanField(default=False, verbose_name='\u010d\xedslo zve\u0159ejn\u011bno', db_column='verejne')), + ], + options={ + 'ordering': ['rocnik__rocnik', 'cislo'], + 'db_table': 'seminar_cisla', + 'verbose_name': '\u010c\xedslo', + 'verbose_name_plural': '\u010c\xedsla', + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='Nastaveni', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('aktualni_cislo', models.ForeignKey(verbose_name='posledn\xed vydan\xe9 \u010d\xedslo', to='seminar.Cislo', on_delete=models.CASCADE)), + ], + options={ + 'db_table': 'seminar_nastaveni', + 'verbose_name': 'Nastaven\xed semin\xe1\u0159e', + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='PrilohaReseni', + fields=[ + ('id', models.AutoField(serialize=False, primary_key=True)), + ('timestamp', models.DateTimeField(auto_now=True, verbose_name='vytvo\u0159eno')), + ('soubor', models.FileField(upload_to=seminar.models.generate_filename, verbose_name='soubor')), + ('poznamka', models.TextField(help_text='Neve\u0159ejn\xe1 pozn\xe1mka k p\u0159\xedloze \u0159e\u0161en\xed (plain text), nap\u0159. o p\u016fvodu', verbose_name='neve\u0159ejn\xe1 pozn\xe1mka', blank=True)), + ], + options={ + 'ordering': ['reseni', 'timestamp'], + 'db_table': 'seminar_priloha_reseni', + 'verbose_name': 'P\u0159\xedloha \u0159e\u0161en\xed', + 'verbose_name_plural': 'P\u0159\xedlohy \u0159e\u0161en\xed', + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='Problem', + fields=[ + ('id', models.AutoField(serialize=False, primary_key=True)), + ('nazev', models.CharField(max_length=256, verbose_name='n\xe1zev')), + ('typ', models.CharField(default=b'uloha', max_length=32, verbose_name='typ probl\xe9mu', choices=[(b'uloha', '\xdaloha'), (b'tema', 'T\xe9ma'), (b'serial', 'Seri\xe1l'), (b'org-clanek', 'Organiz\xe1torsk\xfd \u010dl\xe1nek'), (b'res-clanek', '\u0158esitelsk\xfd \u010dl\xe1nek')])), + ('stav', models.CharField(default=b'navrh', max_length=32, verbose_name='stav probl\xe9mu', choices=[(b'navrh', 'N\xe1vrh'), (b'zadany', 'Zadan\xfd'), (b'smazany', 'Smazan\xfd')])), + ('text_problemu_org', models.TextField(verbose_name='organiz\xe1torsk\xfd (neve\u0159ejn\xfd) text', blank=True)), + ('text_problemu', models.TextField(verbose_name='ve\u0159ejn\xfd text zad\xe1n\xed a \u0159e\u0161en\xed', blank=True)), + ('kod', models.CharField(default=b'', help_text='\u010c\xedslo/k\xf3d \xfalohy v \u010d\xedsle nebo k\xf3d t\xe9matu/\u010dl\xe1nku/seri\xe1lu v ro\u010dn\xedku', max_length=32, verbose_name='lok\xe1ln\xed k\xf3d', blank=True)), + ('body', models.IntegerField(null=True, verbose_name='maximum bod\u016f', blank=True)), + ('autor', models.ForeignKey(related_name='autor_uloh', verbose_name='autor probl\xe9mu', to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)), + ('cislo_reseni', models.ForeignKey(related_name='resene_problemy', blank=True, to='seminar.Cislo', help_text='\u010c\xedslo s \u0159e\u0161en\xedm \xfalohy, jen pro \xfalohy', null=True, verbose_name='\u010d\xedslo \u0159e\u0161en\xed', on_delete=models.CASCADE)), + ('cislo_zadani', models.ForeignKey(related_name='zadane_problemy', verbose_name='\u010d\xedslo zad\xe1n\xed', blank=True, to='seminar.Cislo', null=True, on_delete=models.CASCADE)), + ('opravovatel', models.ForeignKey(related_name='opravovatel_uloh', verbose_name='opravovatel', blank=True, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.CASCADE)), + ], + options={ + 'db_table': 'seminar_problemy', + 'verbose_name': 'Probl\xe9m', + 'verbose_name_plural': 'Probl\xe9my', + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='Reseni', + fields=[ + ('id', models.AutoField(serialize=False, primary_key=True)), + ('body', models.IntegerField(null=True, verbose_name='body', blank=True)), + ('timestamp', models.DateTimeField(auto_now=True, verbose_name='vytvo\u0159eno')), + ('poznamka', models.TextField(help_text='Neve\u0159ejn\xe1 pozn\xe1mka k \u0159e\u0161en\xed (plain text)', verbose_name='neve\u0159ejn\xe1 pozn\xe1mka', blank=True)), + ('cislo_body', models.ForeignKey(related_name='bodovana_reseni', verbose_name='\u010d\xedslo pro body', blank=True, to='seminar.Cislo', null=True, on_delete=models.CASCADE)), + ('problem', models.ForeignKey(related_name='reseni', verbose_name='probl\xe9m', to='seminar.Problem', on_delete=models.CASCADE)), + ], + options={ + 'ordering': ['problem', 'resitel'], + 'db_table': 'seminar_reseni', + 'verbose_name': '\u0158e\u0161en\xed', + 'verbose_name_plural': '\u0158e\u0161en\xed', + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='Resitel', + fields=[ + ('id', models.AutoField(serialize=False, primary_key=True)), + ('jmeno', models.CharField(max_length=256, verbose_name='jm\xe9no')), + ('prijmeni', models.CharField(max_length=256, verbose_name='p\u0159\xedjmen\xed')), + ('pohlavi_muz', models.BooleanField(default=False, verbose_name='pohlav\xed (mu\u017e)')), + ('rok_maturity', models.IntegerField(verbose_name='rok maturity')), + ('email', models.EmailField(default=b'', max_length=256, verbose_name='e-mail', blank=True)), + ('telefon', models.CharField(default=b'', max_length=256, verbose_name='telefon', blank=True)), + ('datum_narozeni', models.DateField(null=True, verbose_name='datum narozen\xed', blank=True)), + ('datum_souhlasu_udaje', models.DateField(help_text='Datum souhlasu se zpracov\xe1n\xedm osobn\xedch \xfadaj\u016f', null=True, verbose_name='datum souhlasu (\xfadaje)', blank=True)), + ('datum_souhlasu_zasilani', models.DateField(help_text='Datum souhlasu se zas\xedl\xe1n\xedm MFF materi\xe1l\u016f', null=True, verbose_name='datum souhlasu (spam)', blank=True)), + ('datum_prihlaseni', models.DateField(default=django.utils.timezone.now, verbose_name='datum p\u0159ihl\xe1\u0161en\xed')), + ('zasilat', models.CharField(default=b'domu', max_length=32, verbose_name='kam zas\xedlat', choices=[(b'domu', 'Dom\u016f'), (b'do_skoly', 'Do \u0161koly'), (b'nikam', 'Nikam')])), + ('ulice', models.CharField(default=b'', max_length=256, verbose_name='ulice', blank=True)), + ('mesto', models.CharField(default=b'', max_length=256, verbose_name='m\u011bsto', blank=True)), + ('psc', models.CharField(default=b'', max_length=32, verbose_name='PS\u010c', blank=True)), + ('stat', django_countries.fields.CountryField(default=b'CZ', help_text='ISO 3166-1 k\xf3d zem\u011b velk\xfdmi p\xedsmeny (CZ, SK, ...)', max_length=2, verbose_name='st\xe1t')), + ('poznamka', models.TextField(help_text='Neve\u0159ejn\xe1 pozn\xe1mka k \u0159e\u0161iteli (plain text)', verbose_name='neve\u0159ejn\xe1 pozn\xe1mka', blank=True)), + ], + options={ + 'ordering': ['prijmeni', 'jmeno'], + 'db_table': 'seminar_resitele', + 'verbose_name': '\u0158e\u0161itel', + 'verbose_name_plural': '\u0158e\u0161itel\xe9', + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='Rocnik', + fields=[ + ('id', models.AutoField(serialize=False, primary_key=True)), + ('prvni_rok', models.IntegerField(verbose_name='prvn\xed rok')), + ('rocnik', models.CharField(max_length=16, verbose_name='\u010d\xedslo ro\u010dn\xedku')), + ], + options={ + 'ordering': ['rocnik'], + 'db_table': 'seminar_rocniky', + 'verbose_name': 'Ro\u010dn\xedk', + 'verbose_name_plural': 'Ro\u010dn\xedky', + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='Skola', + fields=[ + ('id', models.AutoField(serialize=False, primary_key=True)), + ('aesop_id', models.CharField(default=b'', help_text='Aesopi ID typu "izo:..." nebo "aesop:..."', max_length=32, verbose_name='Aesop ID', blank=True)), + ('izo', models.CharField(help_text='IZO \u0161koly (jen \u010desk\xe9 \u0161koly)', max_length=32, verbose_name='IZO', blank=True)), + ('nazev', models.CharField(help_text='Cel\xfd n\xe1zev \u0161koly', max_length=256, verbose_name='n\xe1zev')), + ('kratky_nazev', models.CharField(help_text=b'Zkr\xc3\xa1cen\xc3\xbd n\xc3\xa1zev pro zobrazen\xc3\xad ve v\xc3\xbdsledkovce', max_length=256, verbose_name='zkr\xe1cen\xfd n\xe1zev', blank=True)), + ('ulice', models.CharField(max_length=256, verbose_name='ulice')), + ('mesto', models.CharField(max_length=256, verbose_name='m\u011bsto')), + ('psc', models.CharField(max_length=32, verbose_name='PS\u010c')), + ('stat', django_countries.fields.CountryField(default=b'CZ', help_text='ISO 3166-1 k\xf3d zeme velk\xfdmi p\xedsmeny (CZ, SK, ...)', max_length=2, verbose_name='st\xe1t')), + ('poznamka', models.TextField(help_text='Neve\u0159ejn\xe1 pozn\xe1mka ke \u0161kole (plain text)', verbose_name='neve\u0159ejn\xe1 pozn\xe1mka', blank=True)), + ], + options={ + 'db_table': 'seminar_skoly', + 'verbose_name': '\u0160kola', + 'verbose_name_plural': '\u0160koly', + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='Soustredeni', + fields=[ + ('id', models.AutoField(serialize=False, primary_key=True)), + ('datum_zacatku', models.DateField(help_text='Prvn\xed den soust\u0159ed\u011bn\xed', null=True, verbose_name='datum za\u010d\xe1tku', blank=True)), + ('datum_konce', models.DateField(help_text='Posledn\xed den soust\u0159ed\u011bn\xed', null=True, verbose_name='datum konce', blank=True)), + ('verejne_db', models.BooleanField(default=False, verbose_name='soust\u0159ed\u011bn\xed zve\u0159ejn\u011bno', db_column='verejne')), + ('misto', models.CharField(default=b'', help_text='M\xedsto (n\xe1zev obce, voliteln\u011b t\xe9\u017e objektu', max_length=256, verbose_name='m\xedsto soust\u0159ed\u011bn\xed', blank=True)), + ('rocnik', models.ForeignKey(related_name='soustredeni', verbose_name='ro\u010dn\xedk', to='seminar.Rocnik', on_delete=models.CASCADE)), + ('ucastnici', models.ManyToManyField(help_text='Seznam \xfa\u010dastn\xedk\u016f soust\u0159ed\u011bn\xed', to='seminar.Resitel', db_table='seminar_soustredeni_ucastnici', verbose_name='\xfa\u010dastn\xedci soust\u0159ed\u011bn\xed')), + ], + options={ + 'ordering': ['rocnik__rocnik', 'datum_zacatku'], + 'db_table': 'seminar_soustredeni', + 'verbose_name': 'Soust\u0159ed\u011bn\xed', + 'verbose_name_plural': 'Soust\u0159ed\u011bn\xed', + }, + bases=(models.Model,), + ), + migrations.AddField( + model_name='resitel', + name='skola', + field=models.ForeignKey(verbose_name='\u0161kola', blank=True, to='seminar.Skola', null=True, on_delete=models.CASCADE), + preserve_default=True, + ), + migrations.AddField( + model_name='resitel', + name='user', + field=models.OneToOneField(null=True, blank=True, to=settings.AUTH_USER_MODEL, verbose_name='u\u017eivatel', on_delete=models.CASCADE), + preserve_default=True, + ), + migrations.AddField( + model_name='reseni', + name='resitel', + field=models.ForeignKey(related_name='reseni', verbose_name='\u0159e\u0161itel', to='seminar.Resitel', on_delete=models.CASCADE), + preserve_default=True, + ), + migrations.AddField( + model_name='prilohareseni', + name='reseni', + field=models.ForeignKey(related_name='prilohy', verbose_name='\u0159e\u0161en\xed', to='seminar.Reseni', on_delete=models.CASCADE), + preserve_default=True, + ), + migrations.AddField( + model_name='nastaveni', + name='aktualni_rocnik', + field=models.ForeignKey(verbose_name='aktu\xe1ln\xed ro\u010dn\xedk', to='seminar.Rocnik', on_delete=models.CASCADE), + preserve_default=True, + ), + migrations.AddField( + model_name='cislo', + name='rocnik', + field=models.ForeignKey(related_name='cisla', verbose_name='ro\u010dn\xedk', to='seminar.Rocnik', on_delete=models.CASCADE), + preserve_default=True, + ), + ] diff --git a/seminar/migrations/0001_reset.py b/seminar/migrations/0001_reset.py deleted file mode 100644 index 07ae6c65..00000000 --- a/seminar/migrations/0001_reset.py +++ /dev/null @@ -1,670 +0,0 @@ -# Generated by Django 2.2.4 on 2019-08-19 18:52 - -from django.conf import settings -from django.db import migrations, models -import django.db.models.deletion -import django.utils.timezone -import django_countries.fields -import imagekit.models.fields -import seminar.models -import taggit.managers - - -class Migration(migrations.Migration): - - initial = True - - dependencies = [ - ('taggit', '0003_taggeditem_add_unique_index'), - migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('contenttypes', '0002_remove_content_type_name'), - ] - - operations = [ - migrations.CreateModel( - name='Cislo', - fields=[ - ('id', models.AutoField(primary_key=True, serialize=False)), - ('cislo', models.CharField(db_index=True, help_text='Většinou jen "1", vyjímečně "7-8", lexikograficky určuje pořadí v ročníku!', max_length=32, verbose_name='název čísla')), - ('datum_vydani', models.DateField(blank=True, help_text='Datum vydání finální verze', null=True, verbose_name='datum vydání')), - ('datum_deadline', models.DateField(blank=True, help_text='Datum pro příjem řešení úloh zadaných v tomto čísle', null=True, verbose_name='datum deadline')), - ('datum_deadline_soustredeni', models.DateField(blank=True, help_text='Datum pro příjem řešení pro účast na soustředění', null=True, verbose_name='datum deadline soustředění')), - ('verejne_db', models.BooleanField(db_column='verejne', default=False, verbose_name='číslo zveřejněno')), - ('verejna_vysledkovka', models.BooleanField(default=False, help_text='Je-li false u veřejného čísla, není výsledkovka zatím veřejná.', verbose_name='zveřejněna výsledkovka')), - ('poznamka', models.TextField(blank=True, help_text='Neveřejná poznámka k číslu (plain text)', verbose_name='neveřejná poznámka')), - ('pdf', models.FileField(blank=True, help_text='Pdf čísla, které si mohou řešitelé stáhnout', null=True, upload_to=seminar.models.cislo_pdf_filename, verbose_name='pdf')), - ], - options={ - 'verbose_name': 'Číslo', - 'verbose_name_plural': 'Čísla', - 'db_table': 'seminar_cisla', - 'ordering': ['-rocnik__rocnik', '-cislo'], - }, - ), - migrations.CreateModel( - name='Hodnoceni', - fields=[ - ('id', models.AutoField(primary_key=True, serialize=False)), - ('body', models.DecimalField(decimal_places=1, max_digits=8, verbose_name='body')), - ('cislo_body', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='hodnoceni', to='seminar.Cislo', verbose_name='číslo pro body')), - ], - options={ - 'verbose_name': 'Hodnocení', - 'verbose_name_plural': 'Hodnocení', - 'db_table': 'seminar_hodnoceni', - }, - ), - migrations.CreateModel( - name='Konfera', - fields=[ - ('id', models.AutoField(primary_key=True, serialize=False)), - ('nazev', models.CharField(help_text='Název konfery', max_length=100, verbose_name='název konfery')), - ('anotace', models.TextField(blank=True, help_text='Popis, o čem bude konfera.', verbose_name='anotace')), - ('abstrakt', models.TextField(blank=True, help_text='Abstrakt konfery tak, jak byl uveden ve sborníku', verbose_name='abstrakt')), - ('poznamka', models.TextField(blank=True, help_text='Neveřejná poznámka ke konfeře(plain text)', verbose_name='neveřejná poznámka')), - ('typ_prezentace', models.CharField(choices=[('veletrh', 'Veletrh (postery)'), ('prezentace', 'Prezentace (přednáška)')], default='veletrh', max_length=16, verbose_name='typ prezentace')), - ('prezentace', models.FileField(blank=True, help_text='Prezentace nebo fotka posteru', upload_to=seminar.models.generate_filename_konfera, verbose_name='prezentace')), - ('materialy', models.FileField(blank=True, help_text='Další materiály ke konfeře zabalené do jednoho souboru', upload_to=seminar.models.generate_filename_konfera, verbose_name='materialy')), - ], - options={ - 'verbose_name': 'Konfera', - 'verbose_name_plural': 'Konfery', - 'db_table': 'seminar_konfera', - }, - ), - migrations.CreateModel( - name='Organizator', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('vytvoreno', models.DateTimeField(blank=True, default=django.utils.timezone.now, editable=False, verbose_name='Vytvořeno')), - ('organizuje_od', models.DateTimeField(blank=True, null=True, verbose_name='Organizuje od')), - ('organizuje_do', models.DateTimeField(blank=True, null=True, verbose_name='Organizuje do')), - ('studuje', models.CharField(blank=True, help_text="Např. 'Studuje Obecnou fyziku (Bc.), 3. ročník', 'Vystudovala Diskrétní modely a algoritmy (Mgr.)' nebo 'Přednáší na MFF'", max_length=256, null=True, verbose_name='Studium aj.')), - ('strucny_popis_organizatora', models.TextField(blank=True, null=True, verbose_name='Stručný popis organizátora')), - ('skola', models.CharField(blank=True, help_text='Škola, např. MFF, VŠCHT, VUT, ... prostě aby se nemuselo psát do studuješkolu, ale jen obor, možnost zobrazit zvlášť', max_length=256, null=True, verbose_name='Škola, kterou studuje')), - ], - options={ - 'verbose_name': 'Organizátor', - 'verbose_name_plural': 'Organizátoři', - }, - ), - migrations.CreateModel( - name='Osoba', - fields=[ - ('id', models.AutoField(primary_key=True, serialize=False)), - ('jmeno', models.CharField(max_length=256, verbose_name='jméno')), - ('prijmeni', models.CharField(max_length=256, verbose_name='příjmení')), - ('prezdivka', models.CharField(max_length=256, verbose_name='přezdívka')), - ('pohlavi_muz', models.BooleanField(default=False, verbose_name='pohlaví (muž)')), - ('email', models.EmailField(blank=True, default='', max_length=256, verbose_name='e-mail')), - ('telefon', models.CharField(blank=True, default='', max_length=256, verbose_name='telefon')), - ('datum_narozeni', models.DateField(blank=True, null=True, verbose_name='datum narození')), - ('datum_souhlasu_udaje', models.DateField(blank=True, help_text='Datum souhlasu se zpracováním osobních údajů', null=True, verbose_name='datum souhlasu (údaje)')), - ('datum_souhlasu_zasilani', models.DateField(blank=True, help_text='Datum souhlasu se zasíláním MFF materiálů', null=True, verbose_name='datum souhlasu (spam)')), - ('datum_registrace', models.DateField(default=django.utils.timezone.now, verbose_name='datum registrace do semináře')), - ('ulice', models.CharField(blank=True, default='', max_length=256, verbose_name='ulice')), - ('mesto', models.CharField(blank=True, default='', max_length=256, verbose_name='město')), - ('psc', models.CharField(blank=True, default='', max_length=32, verbose_name='PSČ')), - ('stat', django_countries.fields.CountryField(default='CZ', help_text='ISO 3166-1 kód země velkými písmeny (CZ, SK, ...)', max_length=2, verbose_name='stát')), - ('poznamka', models.TextField(blank=True, help_text='Neveřejná poznámka k osobě (plain text)', verbose_name='neveřejná poznámka')), - ('foto', imagekit.models.fields.ProcessedImageField(blank=True, help_text='Vlož fotografii osoby o libovolné velikosti', null=True, upload_to='image_osoby/velke/%Y/', verbose_name='Fotografie osoby')), - ('user', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, to=settings.AUTH_USER_MODEL, verbose_name='uživatel')), - ], - options={ - 'verbose_name': 'Osoba', - 'verbose_name_plural': 'Osoby', - 'db_table': 'seminar_osoby', - 'ordering': ['prijmeni', 'jmeno'], - }, - ), - migrations.CreateModel( - name='Problem', - fields=[ - ('id', models.AutoField(primary_key=True, serialize=False)), - ('nazev', models.CharField(max_length=256, verbose_name='název')), - ('stav', models.CharField(choices=[('navrh', 'Návrh'), ('zadany', 'Zadaný'), ('vyreseny', 'Vyřešený'), ('smazany', 'Smazaný')], default='navrh', max_length=32, verbose_name='stav problému')), - ('poznamka', models.TextField(blank=True, help_text='Neveřejný návrh úlohy, návrh řešení, text zadání, poznámky ...', verbose_name='org poznámky (HTML)')), - ('kod', models.CharField(blank=True, default='', help_text='Číslo/kód úlohy v čísle nebo kód tématu/článku/seriálu v ročníku', max_length=32, verbose_name='lokální kód')), - ('vytvoreno', models.DateTimeField(blank=True, default=django.utils.timezone.now, editable=False, verbose_name='vytvořeno')), - ('autor', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='autor_problemu_problem', to='seminar.Organizator', verbose_name='autor problému')), - ('garant', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='garant_problemu_problem', to='seminar.Organizator', verbose_name='garant zadaného problému')), - ('nadproblem', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='nadproblem_problem', to='seminar.Problem', verbose_name='nadřazený problém')), - ('opravovatele', models.ManyToManyField(blank=True, related_name='opravovatele_problem', to='seminar.Organizator', verbose_name='opravovatelé')), - ('polymorphic_ctype', models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='polymorphic_seminar.problem_set+', to='contenttypes.ContentType')), - ('zamereni', taggit.managers.TaggableManager(blank=True, help_text='Zaměření M/F/I/O problému, příp. další tagy', through='taggit.TaggedItem', to='taggit.Tag', verbose_name='zaměření')), - ], - options={ - 'verbose_name': 'Problém', - 'verbose_name_plural': 'Problémy', - 'db_table': 'seminar_problemy', - 'ordering': ['nazev'], - }, - ), - migrations.CreateModel( - name='Reseni', - fields=[ - ('id', models.AutoField(primary_key=True, serialize=False)), - ('cas_doruceni', models.DateTimeField(blank=True, default=django.utils.timezone.now, verbose_name='čas_doručení')), - ('forma', models.CharField(choices=[('papir', 'Papírové řešení'), ('email', 'Emailem'), ('upload', 'Upload přes web')], default='email', max_length=16, verbose_name='forma řešení')), - ('poznamka', models.TextField(blank=True, help_text='Neveřejná poznámka k řešení (plain text)', verbose_name='neveřejná poznámka')), - ('zverejneno', models.BooleanField(default=False, help_text='Udává, zda je řešení zveřejněno', verbose_name='řešení zveřejněno')), - ('problem', models.ManyToManyField(help_text='Problém', through='seminar.Hodnoceni', to='seminar.Problem', verbose_name='problém')), - ], - options={ - 'verbose_name': 'Řešení', - 'verbose_name_plural': 'Řešení', - 'db_table': 'seminar_reseni', - 'ordering': ['-cas_doruceni'], - }, - ), - migrations.CreateModel( - name='Resitel', - fields=[ - ('id', models.AutoField(primary_key=True, serialize=False)), - ('rok_maturity', models.IntegerField(blank=True, null=True, verbose_name='rok maturity')), - ('zasilat', models.CharField(choices=[('domu', 'Domů'), ('do_skoly', 'Do školy'), ('nikam', 'Nikam')], default='domu', max_length=32, verbose_name='kam zasílat')), - ('poznamka', models.TextField(blank=True, help_text='Neveřejná poznámka k řešiteli (plain text)', verbose_name='neveřejná poznámka')), - ('osoba', models.OneToOneField(null=True, on_delete=django.db.models.deletion.SET_NULL, to='seminar.Osoba', verbose_name='osoba')), - ], - options={ - 'verbose_name': 'Řešitel', - 'verbose_name_plural': 'Řešitelé', - 'db_table': 'seminar_resitele', - 'ordering': ['osoba'], - }, - ), - migrations.CreateModel( - name='Rocnik', - fields=[ - ('id', models.AutoField(primary_key=True, serialize=False)), - ('prvni_rok', models.IntegerField(db_index=True, unique=True, verbose_name='první rok')), - ('rocnik', models.IntegerField(db_index=True, unique=True, verbose_name='číslo ročníku')), - ('exportovat', models.BooleanField(db_column='exportovat', default=False, help_text='Exportuje se jen podle tohoto flagu (ne veřejnosti), a to jen čísla s veřejnou výsledkovkou', verbose_name='export do AESOPa')), - ], - options={ - 'verbose_name': 'Ročník', - 'verbose_name_plural': 'Ročníky', - 'db_table': 'seminar_rocniky', - 'ordering': ['-rocnik'], - }, - ), - migrations.CreateModel( - name='Soustredeni', - fields=[ - ('id', models.AutoField(primary_key=True, serialize=False)), - ('datum_zacatku', models.DateField(blank=True, help_text='První den soustředění', null=True, verbose_name='datum začátku')), - ('datum_konce', models.DateField(blank=True, help_text='Poslední den soustředění', null=True, verbose_name='datum konce')), - ('verejne_db', models.BooleanField(db_column='verejne', default=False, verbose_name='soustředění zveřejněno')), - ('misto', models.CharField(blank=True, default='', help_text='Místo (název obce, volitelně též objektu', max_length=256, verbose_name='místo soustředění')), - ('text', models.TextField(blank=True, default='', verbose_name='text k soustředění (HTML)')), - ('typ', models.CharField(choices=[('jarni', 'Jarní soustředění'), ('podzimni', 'Podzimní soustředění'), ('vikend', 'Víkendový sraz')], default='podzimni', max_length=16, verbose_name='typ akce')), - ('exportovat', models.BooleanField(db_column='exportovat', default=False, help_text='Exportuje se jen podle tohoto flagu (ne veřejnosti)', verbose_name='export do AESOPa')), - ], - options={ - 'verbose_name': 'Soustředění', - 'verbose_name_plural': 'Soustředění', - 'db_table': 'seminar_soustredeni', - 'ordering': ['-rocnik__rocnik', '-datum_zacatku'], - }, - ), - migrations.CreateModel( - name='Text', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('na_web', models.TextField(blank=True, help_text='Text ke zveřejnění na webu', verbose_name='text na web')), - ('do_cisla', models.TextField(blank=True, help_text='Text ke zveřejnění v čísle', verbose_name='text do čísla')), - ], - options={ - 'verbose_name': 'text', - 'verbose_name_plural': 'texty', - 'db_table': 'seminar_texty', - }, - ), - migrations.CreateModel( - name='TreeNode', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('first_child', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='seminar.TreeNode', verbose_name='první potomek')), - ('polymorphic_ctype', models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='polymorphic_seminar.treenode_set+', to='contenttypes.ContentType')), - ('root', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='potomci_set', to='seminar.TreeNode', verbose_name='kořen stromu')), - ('succ', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='prev', to='seminar.TreeNode', verbose_name='další element na stejné úrovni')), - ], - options={ - 'verbose_name': 'TreeNode', - 'verbose_name_plural': 'TreeNody', - 'db_table': 'seminar_nodes_treenode', - }, - ), - migrations.CreateModel( - name='Clanek', - fields=[ - ('problem_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='seminar.Problem')), - ], - options={ - 'verbose_name': 'Článek', - 'verbose_name_plural': 'Články', - 'db_table': 'seminar_clanky', - }, - bases=('seminar.problem',), - ), - migrations.CreateModel( - name='MezicisloNode', - fields=[ - ('treenode_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='seminar.TreeNode')), - ], - options={ - 'verbose_name': 'Mezičíslo (Node)', - 'verbose_name_plural': 'Mezičísla (Node)', - 'db_table': 'seminar_nodes_mezicislo', - }, - bases=('seminar.treenode',), - ), - migrations.CreateModel( - name='Tema', - fields=[ - ('problem_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='seminar.Problem')), - ('tema_typ', models.CharField(choices=[('tema', 'Téma'), ('serial', 'Seriál')], default='tema', max_length=16, verbose_name='Typ tématu')), - ('rocnik', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='seminar.Rocnik', verbose_name='ročník')), - ], - options={ - 'verbose_name': 'Téma', - 'verbose_name_plural': 'Témata', - 'db_table': 'seminar_temata', - }, - bases=('seminar.problem',), - ), - migrations.CreateModel( - name='Uloha', - fields=[ - ('problem_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='seminar.Problem')), - ('max_body', models.DecimalField(blank=True, decimal_places=1, max_digits=8, null=True, verbose_name='maximum bodů')), - ], - options={ - 'verbose_name': 'Úloha', - 'verbose_name_plural': 'Úlohy', - 'db_table': 'seminar_ulohy', - }, - bases=('seminar.problem',), - ), - migrations.CreateModel( - name='Soustredeni_Ucastnici', - fields=[ - ('id', models.AutoField(primary_key=True, serialize=False)), - ('poznamka', models.TextField(blank=True, help_text='Neveřejná poznámka k účasti (plain text)', verbose_name='neveřejná poznámka')), - ('resitel', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Resitel', verbose_name='řešitel')), - ('soustredeni', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Soustredeni', verbose_name='soustředění')), - ], - options={ - 'verbose_name': 'Účast na soustředění', - 'verbose_name_plural': 'Účasti na soustředění', - 'db_table': 'seminar_soustredeni_ucastnici', - 'ordering': ['soustredeni', 'resitel'], - }, - ), - migrations.CreateModel( - name='Soustredeni_Organizatori', - fields=[ - ('id', models.AutoField(primary_key=True, serialize=False)), - ('poznamka', models.TextField(blank=True, help_text='Neveřejná poznámka k účasti organizátora (plain text)', verbose_name='neveřejná poznámka')), - ('organizator', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Organizator', verbose_name='organizátor')), - ('soustredeni', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Soustredeni', verbose_name='soustředění')), - ], - options={ - 'verbose_name': 'Účast organizátorů na soustředění', - 'verbose_name_plural': 'Účasti organizátorů na soustředění', - 'db_table': 'seminar_soustredeni_organizatori', - 'ordering': ['soustredeni', 'organizator'], - }, - ), - migrations.AddField( - model_name='soustredeni', - name='organizatori', - field=models.ManyToManyField(help_text='Seznam organizátorů soustředění', through='seminar.Soustredeni_Organizatori', to='seminar.Organizator', verbose_name='Organizátoři soustředění'), - ), - migrations.AddField( - model_name='soustredeni', - name='rocnik', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='soustredeni', to='seminar.Rocnik', verbose_name='ročník'), - ), - migrations.AddField( - model_name='soustredeni', - name='ucastnici', - field=models.ManyToManyField(help_text='Seznam účastníků soustředění', through='seminar.Soustredeni_Ucastnici', to='seminar.Resitel', verbose_name='účastníci soustředění'), - ), - migrations.CreateModel( - name='Skola', - fields=[ - ('id', models.AutoField(primary_key=True, serialize=False)), - ('aesop_id', models.CharField(blank=True, default='', help_text='Aesopi ID typu "izo:..." nebo "aesop:..."', max_length=32, verbose_name='Aesop ID')), - ('izo', models.CharField(blank=True, help_text='IZO školy (jen české školy)', max_length=32, verbose_name='IZO')), - ('nazev', models.CharField(help_text='Celý název školy', max_length=256, verbose_name='název')), - ('kratky_nazev', models.CharField(blank=True, help_text='Zkrácený název pro zobrazení ve výsledkovce', max_length=256, verbose_name='zkrácený název')), - ('ulice', models.CharField(max_length=256, verbose_name='ulice')), - ('mesto', models.CharField(max_length=256, verbose_name='město')), - ('psc', models.CharField(max_length=32, verbose_name='PSČ')), - ('stat', django_countries.fields.CountryField(default='CZ', help_text='ISO 3166-1 kód země velkými písmeny (CZ, SK, ...)', max_length=2, verbose_name='stát')), - ('je_zs', models.BooleanField(default=True, verbose_name='základní stupeň')), - ('je_ss', models.BooleanField(default=True, verbose_name='střední stupeň')), - ('poznamka', models.TextField(blank=True, help_text='Neveřejná poznámka ke škole (plain text)', verbose_name='neveřejná poznámka')), - ('kontaktni_osoba', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='seminar.Osoba', verbose_name='Kontaktní osoba')), - ], - options={ - 'verbose_name': 'Škola', - 'verbose_name_plural': 'Školy', - 'db_table': 'seminar_skoly', - 'ordering': ['mesto', 'nazev'], - }, - ), - migrations.AddField( - model_name='resitel', - name='skola', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='seminar.Skola', verbose_name='škola'), - ), - migrations.CreateModel( - name='Reseni_Resitele', - fields=[ - ('id', models.AutoField(primary_key=True, serialize=False)), - ('reseni', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='seminar.Reseni', verbose_name='řešení')), - ('resitele', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Resitel', verbose_name='řešitel')), - ], - options={ - 'verbose_name': 'Řešení řešitelů', - 'verbose_name_plural': 'Řešení řešitelů', - 'db_table': 'seminar_reseni_resitele', - 'ordering': ['reseni', 'resitele'], - }, - ), - migrations.AddField( - model_name='reseni', - name='resitele', - field=models.ManyToManyField(help_text='Seznam autorů řešení', through='seminar.Reseni_Resitele', to='seminar.Resitel', verbose_name='autoři řešení'), - ), - migrations.AddField( - model_name='reseni', - name='text_cely', - field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='reseni_cely_set', to='seminar.Text', verbose_name='Plná verze textu řešení'), - ), - migrations.AddField( - model_name='reseni', - name='text_zkraceny', - field=models.ManyToManyField(help_text='Seznam úryvků z řešení', related_name='reseni_zkraceny_set', to='seminar.Text', verbose_name='zkrácené verze řešení'), - ), - migrations.CreateModel( - name='PrilohaReseni', - fields=[ - ('id', models.AutoField(primary_key=True, serialize=False)), - ('vytvoreno', models.DateTimeField(blank=True, default=django.utils.timezone.now, editable=False, verbose_name='vytvořeno')), - ('soubor', models.FileField(upload_to=seminar.models.generate_filename, verbose_name='soubor')), - ('poznamka', models.TextField(blank=True, help_text='Neveřejná poznámka k příloze řešení (plain text), např. o původu', verbose_name='neveřejná poznámka')), - ('reseni', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='prilohy', to='seminar.Reseni', verbose_name='řešení')), - ], - options={ - 'verbose_name': 'Příloha řešení', - 'verbose_name_plural': 'Přílohy řešení', - 'db_table': 'seminar_priloha_reseni', - 'ordering': ['reseni', 'vytvoreno'], - }, - ), - migrations.CreateModel( - name='Prijemce', - fields=[ - ('id', models.AutoField(primary_key=True, serialize=False)), - ('poznamka', models.TextField(blank=True, help_text='Neveřejná poznámka k příemci čísel (plain text)', verbose_name='neveřejná poznámka')), - ('osoba', 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')), - ], - options={ - 'verbose_name': 'příjemce', - 'verbose_name_plural': 'příjemce', - 'db_table': 'seminar_prijemce', - }, - ), - migrations.CreateModel( - name='Pohadka', - fields=[ - ('id', models.AutoField(primary_key=True, serialize=False)), - ('vytvoreno', models.DateTimeField(blank=True, default=django.utils.timezone.now, editable=False, verbose_name='Vytvořeno')), - ('autor', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='seminar.Organizator', verbose_name='Autor pohádky')), - ], - options={ - 'verbose_name': 'Pohádka', - 'verbose_name_plural': 'Pohádky', - 'db_table': 'seminar_pohadky', - 'ordering': ['vytvoreno'], - }, - ), - migrations.AddField( - model_name='organizator', - name='osoba', - field=models.OneToOneField(help_text='osobní údaje organizátora', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='org', to='seminar.Osoba', verbose_name='osoba'), - ), - migrations.CreateModel( - name='Obrazek', - fields=[ - ('id', models.AutoField(primary_key=True, serialize=False)), - ('na_web', models.ImageField(blank=True, null=True, upload_to='obrazky/%Y/%m/%d/', verbose_name='obrázek na web')), - ('do_cisla_barevny', models.FileField(blank=True, help_text='Barevná verze obrázku do čísla', null=True, upload_to='obrazky/%Y/%m/%d/', verbose_name='barevný obrázek do čísla')), - ('do_cisla_cernobily', models.FileField(blank=True, help_text='Černobílá verze obrázku do čísla', null=True, upload_to='obrazky/%Y/%m/%d/', verbose_name='černobílý obrázek do čísla')), - ('text', models.ForeignKey(help_text='text, ve kterém se obrázek vyskytuje', on_delete=django.db.models.deletion.CASCADE, to='seminar.Text', verbose_name='text')), - ], - options={ - 'verbose_name': 'obrázek', - 'verbose_name_plural': 'obrázky', - 'db_table': 'seminar_obrazky', - }, - ), - migrations.CreateModel( - name='Novinky', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('datum', models.DateField(auto_now_add=True)), - ('text', models.TextField(blank=True, null=True, verbose_name='Text novinky')), - ('obrazek', models.ImageField(blank=True, null=True, upload_to='image_novinky/%Y/%m/%d/', verbose_name='Obrázek')), - ('zverejneno', models.BooleanField(default=False, verbose_name='Zveřejněno')), - ('autor', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='seminar.Organizator', verbose_name='Autor novinky')), - ], - options={ - 'verbose_name': 'Novinka', - 'verbose_name_plural': 'Novinky', - 'ordering': ['-datum'], - }, - ), - migrations.CreateModel( - name='Nastaveni', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('aktualni_cislo', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Cislo', verbose_name='poslední vydané číslo')), - ('aktualni_rocnik', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Rocnik', verbose_name='aktuální ročník')), - ], - options={ - 'verbose_name': 'Nastavení semináře', - 'db_table': 'seminar_nastaveni', - }, - ), - migrations.CreateModel( - name='Konfery_Ucastnici', - fields=[ - ('id', models.AutoField(primary_key=True, serialize=False)), - ('poznamka', models.TextField(blank=True, help_text='Neveřejná poznámka k účasti (plain text)', verbose_name='neveřejná poznámka')), - ('konfera', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='seminar.Konfera', verbose_name='konfera')), - ('resitel', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Resitel', verbose_name='řešitel')), - ], - options={ - 'verbose_name': 'Účast na konfeře', - 'verbose_name_plural': 'Účasti na konfeře', - 'db_table': 'seminar_konfery_ucastnici', - 'ordering': ['konfera', 'resitel'], - }, - ), - migrations.AddField( - model_name='konfera', - name='organizator', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='konfery', to='seminar.Organizator', verbose_name='organizátor'), - ), - migrations.AddField( - model_name='konfera', - name='reseni', - field=models.OneToOneField(blank=True, help_text='Účastnický přípěvek o konfeře', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='konfery', to='seminar.Reseni', verbose_name='článek ke konfeře'), - ), - migrations.AddField( - model_name='konfera', - name='soustredeni', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='konfery', to='seminar.Soustredeni', verbose_name='soustředění'), - ), - migrations.AddField( - model_name='konfera', - name='ucastnici', - field=models.ManyToManyField(help_text='Seznam účastníků konfery', through='seminar.Konfery_Ucastnici', to='seminar.Resitel', verbose_name='účastníci konfery'), - ), - migrations.AddField( - model_name='hodnoceni', - name='problem', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Problem', verbose_name='problém'), - ), - migrations.AddField( - model_name='hodnoceni', - name='reseni', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='seminar.Reseni', verbose_name='řešení'), - ), - migrations.AddField( - model_name='cislo', - name='rocnik', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='cisla', to='seminar.Rocnik', verbose_name='ročník'), - ), - migrations.CreateModel( - name='UlohaZadaniNode', - fields=[ - ('treenode_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='seminar.TreeNode')), - ('uloha', models.OneToOneField(null=True, on_delete=django.db.models.deletion.PROTECT, to='seminar.Uloha', verbose_name='úloha')), - ], - options={ - 'verbose_name': 'Zadání úlohy (Node)', - 'verbose_name_plural': 'Zadání úloh (Node)', - 'db_table': 'seminar_nodes_uloha_zadani', - }, - bases=('seminar.treenode',), - ), - migrations.CreateModel( - name='UlohaVzorakNode', - fields=[ - ('treenode_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='seminar.TreeNode')), - ('uloha', models.OneToOneField(null=True, on_delete=django.db.models.deletion.PROTECT, to='seminar.Uloha', verbose_name='úloha')), - ], - options={ - 'verbose_name': 'Vzorák úlohy (Node)', - 'verbose_name_plural': 'Vzoráky úloh (Node)', - 'db_table': 'seminar_nodes_uloha_vzorak', - }, - bases=('seminar.treenode',), - ), - migrations.AddField( - model_name='uloha', - name='cislo_deadline', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='deadlinove_ulohy', to='seminar.Cislo', verbose_name='číslo deadlinu'), - ), - migrations.AddField( - model_name='uloha', - name='cislo_reseni', - field=models.ForeignKey(blank=True, help_text='Číslo s řešením úlohy, jen pro úlohy', null=True, on_delete=django.db.models.deletion.PROTECT, related_name='resene_ulohy', to='seminar.Cislo', verbose_name='číslo řešení'), - ), - migrations.AddField( - model_name='uloha', - name='cislo_zadani', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='zadane_ulohy', to='seminar.Cislo', verbose_name='číslo zadání'), - ), - migrations.CreateModel( - name='TextNode', - fields=[ - ('treenode_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='seminar.TreeNode')), - ('text', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Text', verbose_name='text')), - ], - options={ - 'verbose_name': 'Text (Node)', - 'verbose_name_plural': 'Text (Node)', - 'db_table': 'seminar_nodes_obsah', - }, - bases=('seminar.treenode',), - ), - migrations.CreateModel( - name='TemaVCisleNode', - fields=[ - ('treenode_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='seminar.TreeNode')), - ('tema', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Tema', verbose_name='téma v čísle')), - ], - options={ - 'verbose_name': 'Téma v čísle (Node)', - 'verbose_name_plural': 'Témata v čísle (Node)', - 'db_table': 'seminar_nodes_temavcisle', - }, - bases=('seminar.treenode',), - ), - migrations.CreateModel( - name='RocnikNode', - fields=[ - ('treenode_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='seminar.TreeNode')), - ('rocnik', models.OneToOneField(on_delete=django.db.models.deletion.PROTECT, to='seminar.Rocnik', verbose_name='ročník')), - ], - options={ - 'verbose_name': 'Ročník (Node)', - 'verbose_name_plural': 'Ročníky (Node)', - 'db_table': 'seminar_nodes_rocnik', - }, - bases=('seminar.treenode',), - ), - migrations.CreateModel( - name='PohadkaNode', - fields=[ - ('treenode_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='seminar.TreeNode')), - ('pohadka', models.OneToOneField(on_delete=django.db.models.deletion.PROTECT, to='seminar.Pohadka', verbose_name='pohádka')), - ], - options={ - 'verbose_name': 'Pohádka (Node)', - 'verbose_name_plural': 'Pohádky (Node)', - 'db_table': 'seminar_nodes_pohadka', - }, - bases=('seminar.treenode',), - ), - migrations.CreateModel( - name='KonferaNode', - fields=[ - ('treenode_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='seminar.TreeNode')), - ('konfera', models.OneToOneField(null=True, on_delete=django.db.models.deletion.PROTECT, to='seminar.Konfera', verbose_name='konfera')), - ], - options={ - 'verbose_name': 'Konfera (Node)', - 'verbose_name_plural': 'Konfery (Node)', - 'db_table': 'seminar_nodes_konfera', - }, - bases=('seminar.treenode',), - ), - migrations.CreateModel( - name='ClanekNode', - fields=[ - ('treenode_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='seminar.TreeNode')), - ('clanek', models.OneToOneField(null=True, on_delete=django.db.models.deletion.PROTECT, to='seminar.Clanek', verbose_name='článek')), - ], - options={ - 'verbose_name': 'Článek (Node)', - 'verbose_name_plural': 'Články (Node)', - 'db_table': 'seminar_nodes_clanek', - }, - bases=('seminar.treenode',), - ), - migrations.AddField( - model_name='clanek', - name='cislo', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='seminar.Cislo', verbose_name='číslo'), - ), - migrations.CreateModel( - name='CisloNode', - fields=[ - ('treenode_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='seminar.TreeNode')), - ('cislo', models.OneToOneField(on_delete=django.db.models.deletion.PROTECT, to='seminar.Cislo', verbose_name='číslo')), - ], - options={ - 'verbose_name': 'Číslo (Node)', - 'verbose_name_plural': 'Čísla (Node)', - 'db_table': 'seminar_nodes_cislo', - }, - bases=('seminar.treenode',), - ), - ] diff --git a/seminar/migrations/0002_add_body_views.py b/seminar/migrations/0002_add_body_views.py new file mode 100644 index 00000000..3d128ab9 --- /dev/null +++ b/seminar/migrations/0002_add_body_views.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +import django_countries.fields +import seminar.models +import django.utils.timezone +from django.conf import settings + +CREATE_VIEWS=""" +create view seminar_body_za_cislo as + select + sr.cislo_body_id || '-' || sr.resitel_id as id, + sr.cislo_body_id as cislo_id, + sr.resitel_id as resitel_id, + sum(sr.body) as body + from seminar_reseni as sr + group by sr.cislo_body_id, sr.resitel_id + order by body desc; + +create view seminar_body_k_cislu as + select + akt_c.id || '-' || min_bzc.resitel_id as id, + akt_c.id as cislo_id, + min_bzc.resitel_id as resitel_id, + max(akt_bzc.body) as body, + sum(min_bzc.body) as body_celkem + from ((seminar_cisla as akt_c + inner join seminar_cisla as min_c on min_c.rocnik_id = akt_c.rocnik_id and akt_c.cislo >= min_c.cislo) + inner join seminar_body_za_cislo as min_bzc on min_c.id = min_bzc.cislo_id) + left outer join seminar_body_za_cislo as akt_bzc on akt_bzc.cislo_id = akt_c.id and akt_bzc.resitel_id = min_bzc.resitel_id + group by akt_c.id, min_bzc.resitel_id, akt_bzc.resitel_id + order by body_celkem desc; +""" + +DROP_VIEWS=""" +drop view seminar_body_k_cislu; +drop view seminar_body_za_cislo; +""" + +class Migration(migrations.Migration): + + dependencies = [("seminar", "0001_initial")] + + operations = [ + migrations.RunSQL(sql=CREATE_VIEWS, reverse_sql=DROP_VIEWS) + ] + diff --git a/seminar/migrations/0003_add_skola_zs_ss.py b/seminar/migrations/0003_add_skola_zs_ss.py new file mode 100644 index 00000000..1b1fbb80 --- /dev/null +++ b/seminar/migrations/0003_add_skola_zs_ss.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0002_add_body_views'), + ] + + operations = [ + migrations.AddField( + model_name='skola', + name='je_ss', + field=models.BooleanField(default=True, verbose_name='st\u0159edn\xed stupe\u0148'), + preserve_default=False, + ), + migrations.AddField( + model_name='skola', + name='je_zs', + field=models.BooleanField(default=True, verbose_name='z\xe1kladn\xed stupe\u0148'), + preserve_default=False, + ), + migrations.AlterField( + model_name='reseni', + name='poznamka', + field=models.TextField(help_text='Neve\u0159ejn\xe1 pozn\xe1mka k \u0159e\u0161en\xed (plain text, editace v detailu \u0159e\u0161en\xed)', verbose_name='neve\u0159ejn\xe1 pozn\xe1mka', blank=True), + preserve_default=True, + ), + ] diff --git a/seminar/migrations/0004_add_old_dakos_id.py b/seminar/migrations/0004_add_old_dakos_id.py new file mode 100644 index 00000000..1ec28943 --- /dev/null +++ b/seminar/migrations/0004_add_old_dakos_id.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0003_add_skola_zs_ss'), + ] + + operations = [ + migrations.AddField( + model_name='problem', + name='dakos_id', + field=models.CharField(default=b'', help_text='DaKoS ID z exportu, s prefixem podle p\u016fvodu: "AZAD:xxx" (z MM_AZAD), "DOZ:xxx" (z MM_DOZ), "ZAD:xxx" (z MM_ZADANIA)', max_length=32, verbose_name='Star\xe9 DaKoS ID', blank=True), + preserve_default=True, + ), + migrations.AddField( + model_name='resitel', + name='dakos_id', + field=models.CharField(default=b'', help_text='DaKoS ID z exportu, jen historick\xfd v\xfdznam, podle tabulky mamoper.MM_RIESITELIA', max_length=32, verbose_name='Stare DaKoS ID', blank=True), + preserve_default=True, + ), + migrations.AddField( + model_name='skola', + name='dakos_id', + field=models.CharField(default=b'', help_text='DaKoS ID z exportu, jen historick\xfd v\xfdznam, podle tabulky dksroot.V_skola', max_length=32, verbose_name='Stare DaKoS ID', blank=True), + preserve_default=True, + ), + migrations.AlterField( + model_name='skola', + name='je_ss', + field=models.BooleanField(default=True, verbose_name='st\u0159edn\xed stupe\u0148'), + preserve_default=True, + ), + migrations.AlterField( + model_name='skola', + name='je_zs', + field=models.BooleanField(default=True, verbose_name='z\xe1kladn\xed stupe\u0148'), + preserve_default=True, + ), + ] diff --git a/seminar/migrations/0005_alter_problem_autor.py b/seminar/migrations/0005_alter_problem_autor.py new file mode 100644 index 00000000..d8a40585 --- /dev/null +++ b/seminar/migrations/0005_alter_problem_autor.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +from django.conf import settings + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0004_add_old_dakos_id'), + ] + + operations = [ + migrations.AlterField( + model_name='problem', + name='autor', + field=models.ForeignKey(related_name='autor_uloh', verbose_name='autor probl\xe9mu', blank=True, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.CASCADE), + preserve_default=True, + ), + ] diff --git a/seminar/migrations/0006_problem_add_timestamp.py b/seminar/migrations/0006_problem_add_timestamp.py new file mode 100644 index 00000000..3df8bfdb --- /dev/null +++ b/seminar/migrations/0006_problem_add_timestamp.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +import datetime +from django.utils.timezone import utc + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0005_alter_problem_autor'), + ] + + operations = [ + migrations.AddField( + model_name='problem', + name='timestamp', + field=models.DateTimeField(default=datetime.datetime(2015, 5, 15, 8, 54, 56, 319985, tzinfo=utc), verbose_name='vytvo\u0159eno', auto_now=True), + preserve_default=False, + ), + migrations.AlterField( + model_name='problem', + name='dakos_id', + field=models.CharField(default=b'', help_text='DaKoS ID z exportu, s prefixem podle p\u016fvodu: "AZAD:xxx (z MM_AZAD), ""DOZ:xxx" (z MM_DOZ), "ZAD:rocnik.cislo.uloha.typ" (z MM_ZADANIA)', max_length=32, verbose_name='Star\xe9 DaKoS ID', blank=True), + preserve_default=True, + ), + ] diff --git a/seminar/migrations/0007_problem_zamereni.py b/seminar/migrations/0007_problem_zamereni.py new file mode 100644 index 00000000..10718bd7 --- /dev/null +++ b/seminar/migrations/0007_problem_zamereni.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +import taggit.managers + + +class Migration(migrations.Migration): + + dependencies = [ + ('taggit', '0001_initial'), + ('seminar', '0006_problem_add_timestamp'), + ] + + operations = [ + migrations.AddField( + model_name='problem', + name='zamereni', + field=taggit.managers.TaggableManager(to='taggit.Tag', through='taggit.TaggedItem', blank=True, help_text=b'Zam\xc4\x9b\xc5\x99en\xc3\xad M/F/I/O probl\xc3\xa9mu, p\xc5\x99\xc3\xadp. dal\xc5\xa1\xc3\xad tagy', verbose_name='zam\u011b\u0159en\xed'), + preserve_default=True, + ), + ] diff --git a/seminar/migrations/0008_reseni_forma.py b/seminar/migrations/0008_reseni_forma.py new file mode 100644 index 00000000..399e81a9 --- /dev/null +++ b/seminar/migrations/0008_reseni_forma.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0007_problem_zamereni'), + ] + + operations = [ + migrations.AddField( + model_name='reseni', + name='forma', + field=models.CharField(default=b'papir', max_length=16, verbose_name='forma \u0159e\u0161en\xed', choices=[(b'papir', 'Pap\xedrov\xe9 \u0159e\u0161en\xed'), (b'email', 'Emailem'), (b'upload', 'Upload p\u0159es web')]), + preserve_default=True, + ), + ] diff --git a/seminar/migrations/0009_rename_imported_IDs.py b/seminar/migrations/0009_rename_imported_IDs.py new file mode 100644 index 00000000..997bc0ac --- /dev/null +++ b/seminar/migrations/0009_rename_imported_IDs.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0008_reseni_forma'), + ] + + operations = [ + migrations.RenameField( + model_name='problem', + old_name='dakos_id', + new_name='import_dakos_id', + ), + migrations.RenameField( + model_name='resitel', + old_name='dakos_id', + new_name='import_mamoper_id', + ), + migrations.RenameField( + model_name='skola', + old_name='dakos_id', + new_name='import_dakos_id', + ), + migrations.AlterField( + model_name='problem', + name='import_dakos_id', + field=models.CharField(default=b'', help_text='ID z importu z DAKOSU s prefixem podle p\u016fvodu: "AZAD:xxx (MAMOPER.MM_AZAD), ""DOZ:xxx" (MAMOPER.MM_DOZ), "ZAD:rocnik.cislo.uloha.typ" (MAMOPER.MM_ZADANIA)', max_length=32, verbose_name='importovan\xe9 ID s typem', blank=True), + preserve_default=True, + ), + migrations.AlterField( + model_name='resitel', + name='import_mamoper_id', + field=models.CharField(default=b'', help_text='MAMOPER.MM_RIESITELIA.ID z DAKOS importu, jen historick\xfd v\xfdznam', max_length=32, verbose_name='importovan\xe9 MM_RIESITELIA.ID', blank=True), + preserve_default=True, + ), + migrations.AlterField( + model_name='skola', + name='import_dakos_id', + field=models.CharField(default=b'', help_text='DKSROOT.V_SKOLA.ID z DAKOS importu, jen historick\xfd v\xfdznam', max_length=32, verbose_name='importovan\xe9 DKSROOT.V_SKOLA.ID', blank=True), + preserve_default=True, + ), + ] diff --git a/seminar/migrations/0010_alter_rok_maturity.py b/seminar/migrations/0010_alter_rok_maturity.py new file mode 100644 index 00000000..58c099fb --- /dev/null +++ b/seminar/migrations/0010_alter_rok_maturity.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0009_rename_imported_IDs'), + ] + + operations = [ + migrations.AlterField( + model_name='resitel', + name='rok_maturity', + field=models.IntegerField(null=True, verbose_name='rok maturity', blank=True), + preserve_default=True, + ), + ] diff --git a/seminar/migrations/0011_alter_timestamp_def.py b/seminar/migrations/0011_alter_timestamp_def.py new file mode 100644 index 00000000..238386a6 --- /dev/null +++ b/seminar/migrations/0011_alter_timestamp_def.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +import django.utils.timezone + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0010_alter_rok_maturity'), + ] + + operations = [ + migrations.AlterField( + model_name='prilohareseni', + name='timestamp', + field=models.DateTimeField(default=django.utils.timezone.now, verbose_name='vytvo\u0159eno', editable=False, blank=True), + preserve_default=True, + ), + migrations.AlterField( + model_name='problem', + name='import_dakos_id', + field=models.CharField(default=b'', help_text='ID z importu z DAKOSU s prefixem podle p\u016fvodu: "AZAD:xxx (MAMOPER.MM_AZAD), ""DOZ:xxx" (MAMOPER.MM_DOZ), "ZAD:rocnik.cislo.uloha.typ" (MAMOPER.MM_ZADANIA), "ULOHA:xxx" (MAMOPER.MM_ULOHY)', max_length=32, verbose_name='importovan\xe9 ID s typem', blank=True), + preserve_default=True, + ), + migrations.AlterField( + model_name='problem', + name='timestamp', + field=models.DateTimeField(default=django.utils.timezone.now, verbose_name='vytvo\u0159eno', editable=False, blank=True), + preserve_default=True, + ), + migrations.AlterField( + model_name='reseni', + name='timestamp', + field=models.DateTimeField(default=django.utils.timezone.now, verbose_name='vytvo\u0159eno', editable=False, blank=True), + preserve_default=True, + ), + ] diff --git a/seminar/migrations/0012_remove_soustredeni_ucastnici.py b/seminar/migrations/0012_remove_soustredeni_ucastnici.py new file mode 100644 index 00000000..ddb61304 --- /dev/null +++ b/seminar/migrations/0012_remove_soustredeni_ucastnici.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0011_alter_timestamp_def'), + ] + + operations = [ + migrations.RemoveField( + model_name='soustredeni', + name='ucastnici', + ), + ] diff --git a/seminar/migrations/0013_soustredeni_ucastnici_through_model.py b/seminar/migrations/0013_soustredeni_ucastnici_through_model.py new file mode 100644 index 00000000..c725691d --- /dev/null +++ b/seminar/migrations/0013_soustredeni_ucastnici_through_model.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0012_remove_soustredeni_ucastnici'), + ] + + operations = [ + migrations.CreateModel( + name='Soustredeni_Ucastnici', + fields=[ + ('id', models.AutoField(serialize=False, primary_key=True)), + ('poznamka', models.CharField(default=b'', help_text='Neve\u0159ejn\xe1 pozn\xe1mka k \xfa\u010dasti (plain text)', max_length=64, verbose_name='neve\u0159ejn\xe1 pozn\xe1mka', blank=True)), + ('resitel', models.ForeignKey(verbose_name='\u0159e\u0161itel', to='seminar.Resitel', on_delete=models.CASCADE)), + ('soustredeni', models.ForeignKey(verbose_name='soust\u0159ed\u011bn\xed', to='seminar.Soustredeni',on_delete=models.CASCADE)), + ], + options={ + 'ordering': ['soustredeni', 'resitel'], + 'db_table': 'seminar_soustredeni_ucastnici', + 'verbose_name': '\xda\u010dast na soust\u0159ed\u011bn\xed', + 'verbose_name_plural': '\xda\u010dasti na soust\u0159ed\u011bn\xed', + }, + bases=(models.Model,), + ), + migrations.AddField( + model_name='soustredeni', + name='ucastnici', + field=models.ManyToManyField(help_text='Seznam \xfa\u010dastn\xedk\u016f soust\u0159ed\u011bn\xed', to='seminar.Resitel', verbose_name='\xfa\u010dastn\xedci soust\u0159ed\u011bn\xed', through='seminar.Soustredeni_Ucastnici'), + preserve_default=True, + ), + ] diff --git a/seminar/migrations/0014_uprava_poznamek.py b/seminar/migrations/0014_uprava_poznamek.py new file mode 100644 index 00000000..0eb34984 --- /dev/null +++ b/seminar/migrations/0014_uprava_poznamek.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0013_soustredeni_ucastnici_through_model'), + ] + + operations = [ + migrations.AlterModelOptions( + name='problem', + options={'ordering': ['nazev'], 'verbose_name': 'Probl\xe9m', 'verbose_name_plural': 'Probl\xe9my'}, + ), + migrations.AlterModelOptions( + name='reseni', + options={'ordering': ['problem_id', 'resitel_id'], 'verbose_name': '\u0158e\u0161en\xed', 'verbose_name_plural': '\u0158e\u0161en\xed'}, + ), + migrations.AlterModelOptions( + name='skola', + options={'ordering': ['mesto', 'nazev'], 'verbose_name': '\u0160kola', 'verbose_name_plural': '\u0160koly'}, + ), + migrations.AddField( + model_name='cislo', + name='poznamka', + field=models.TextField(help_text='Neve\u0159ejn\xe1 pozn\xe1mka k \u010d\xedslu (plain text)', verbose_name='neve\u0159ejn\xe1 pozn\xe1mka', blank=True), + preserve_default=True, + ), + migrations.AlterField( + model_name='problem', + name='text_problemu_org', + field=models.TextField(verbose_name='neve\u0159ejn\xe9 zad\xe1n\xed a organiz\xe1torsk\xe9 a pozn\xe1mky', blank=True), + preserve_default=True, + ), + migrations.AlterField( + model_name='reseni', + name='poznamka', + field=models.TextField(help_text='Neve\u0159ejn\xe1 pozn\xe1mka k \u0159e\u0161en\xed (plain text)', verbose_name='neve\u0159ejn\xe1 pozn\xe1mka', blank=True), + preserve_default=True, + ), + migrations.AlterField( + model_name='soustredeni_ucastnici', + name='poznamka', + field=models.TextField(help_text='Neve\u0159ejn\xe1 pozn\xe1mka k \xfa\u010dasti (plain text)', verbose_name='neve\u0159ejn\xe1 pozn\xe1mka', blank=True), + preserve_default=True, + ), + ] diff --git a/seminar/migrations/0015_soustredeni_text.py b/seminar/migrations/0015_soustredeni_text.py new file mode 100644 index 00000000..87298eba --- /dev/null +++ b/seminar/migrations/0015_soustredeni_text.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0014_uprava_poznamek'), + ] + + operations = [ + migrations.AddField( + model_name='soustredeni', + name='text', + field=models.TextField(default=b'', verbose_name='text k soust\u0159ed\u011bn\xed (HTML)', blank=True), + preserve_default=True, + ), + ] diff --git a/seminar/migrations/0016_texty_problemu.py b/seminar/migrations/0016_texty_problemu.py new file mode 100644 index 00000000..451c888e --- /dev/null +++ b/seminar/migrations/0016_texty_problemu.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0015_soustredeni_text'), + ] + + operations = [ + migrations.RenameField( + model_name='problem', + old_name='text_problemu_org', + new_name='text_org', + ), + migrations.RenameField( + model_name='problem', + old_name='text_problemu', + new_name='text_zadani', + ), + migrations.AddField( + model_name='problem', + name='text_reseni', + field=models.TextField(help_text='Ve\u0159ejn\xfd text \u0159e\u0161en\xed (HTML, u t\xe9mat i p\u0159\xedsp\u011bvky a koment\xe1\u0159e)', verbose_name='ve\u0159ejn\xe9 \u0159e\u0161en\xed (HTML)', blank=True), + preserve_default=True, + ), + migrations.AlterField( + model_name='problem', + name='text_org', + field=models.TextField(help_text='Neve\u0159ejn\xfd n\xe1vrh \xfalohy, n\xe1vrh \u0159e\u0161en\xed, text zad\xe1n\xed, pozn\xe1mky ...', verbose_name='org pozn\xe1mky (HTML)', blank=True), + preserve_default=True, + ), + migrations.AlterField( + model_name='problem', + name='text_zadani', + field=models.TextField(help_text='Ve\u0159ejn\xfd text zad\xe1n\xed (HTML)', verbose_name='ve\u0159ejn\xe9 zad\xe1n\xed (HTML)', blank=True), + preserve_default=True, + ), + ] diff --git a/seminar/migrations/0017_texty_problemu_minor.py b/seminar/migrations/0017_texty_problemu_minor.py new file mode 100644 index 00000000..f732c111 --- /dev/null +++ b/seminar/migrations/0017_texty_problemu_minor.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0016_texty_problemu'), + ] + + operations = [ + migrations.AlterField( + model_name='problem', + name='text_reseni', + field=models.TextField(help_text='Ve\u0159ejn\xfd text \u0159e\u0161en\xed (HTML, u t\xe9mat i p\u0159\xedsp\u011bvky a koment\xe1\u0159e)', verbose_name='ve\u0159ejn\xe9 \u0159e\u0161en\xed (HTML)', blank=True), + preserve_default=True, + ), + ] diff --git a/seminar/migrations/0018_problemnavrh_problemzadany.py b/seminar/migrations/0018_problemnavrh_problemzadany.py new file mode 100644 index 00000000..afdcfa8c --- /dev/null +++ b/seminar/migrations/0018_problemnavrh_problemzadany.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0017_texty_problemu_minor'), + ] + + operations = [ + migrations.CreateModel( + name='ProblemNavrh', + fields=[ + ], + options={ + 'verbose_name': 'Probl\xe9m (n\xe1vrh)', + 'proxy': True, + 'verbose_name_plural': 'Probl\xe9my (n\xe1vrhy)', + }, + bases=('seminar.problem',), + ), + migrations.CreateModel( + name='ProblemZadany', + fields=[ + ], + options={ + 'verbose_name': 'Probl\xe9m (zadan\xfd)', + 'proxy': True, + 'verbose_name_plural': 'Probl\xe9my (zadan\xe9)', + }, + bases=('seminar.problem',), + ), + ] diff --git a/seminar/migrations/0019_rocnik_ciselne.py b/seminar/migrations/0019_rocnik_ciselne.py new file mode 100644 index 00000000..42308b2f --- /dev/null +++ b/seminar/migrations/0019_rocnik_ciselne.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0018_problemnavrh_problemzadany'), + ] + + operations = [ + migrations.AddField( + model_name='rocnik', + name='rocnik_n', + field=models.IntegerField(default=0, verbose_name='\u010d\xedslo ro\u010dn\xedku'), + preserve_default=False, + ), + migrations.RunSQL( + sql="update seminar_rocniky set rocnik_n = cast (rocnik as integer)" + ), + migrations.RemoveField( + model_name='rocnik', + name='rocnik', + ), + migrations.RenameField( + model_name='rocnik', + old_name='rocnik_n', + new_name='rocnik', + ), + ] diff --git a/seminar/migrations/0020_indexy_a_razeni.py b/seminar/migrations/0020_indexy_a_razeni.py new file mode 100644 index 00000000..1e199f0e --- /dev/null +++ b/seminar/migrations/0020_indexy_a_razeni.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0019_rocnik_ciselne'), + ] + + operations = [ + migrations.AlterModelOptions( + name='cislo', + options={'ordering': ['-rocnik__rocnik', '-cislo'], 'verbose_name': '\u010c\xedslo', 'verbose_name_plural': '\u010c\xedsla'}, + ), + migrations.AlterModelOptions( + name='reseni', + options={'ordering': ['problem_id', 'resitel__prijmeni', 'resitel__jmeno'], 'verbose_name': '\u0158e\u0161en\xed', 'verbose_name_plural': '\u0158e\u0161en\xed'}, + ), + migrations.AlterModelOptions( + name='rocnik', + options={'ordering': ['-rocnik'], 'verbose_name': 'Ro\u010dn\xedk', 'verbose_name_plural': 'Ro\u010dn\xedky'}, + ), + migrations.AlterField( + model_name='cislo', + name='cislo', + field=models.CharField(help_text='V\u011bt\u0161inou jen "1", vyj\xedme\u010dn\u011b "7-8", lexikograficky ur\u010dije po\u0159ad\xed v ro\u010dn\xedku!', max_length=32, verbose_name='n\xe1zev \u010d\xedsla', db_index=True), + preserve_default=True, + ), + migrations.AlterField( + model_name='rocnik', + name='prvni_rok', + field=models.IntegerField(unique=True, verbose_name='prvn\xed rok', db_index=True), + preserve_default=True, + ), + migrations.AlterField( + model_name='rocnik', + name='rocnik', + field=models.IntegerField(unique=True, verbose_name='\u010d\xedslo ro\u010dn\xedku', db_index=True), + preserve_default=True, + ), + ] diff --git a/seminar/migrations/0021_cislo_verejna_vysledkovka.py b/seminar/migrations/0021_cislo_verejna_vysledkovka.py new file mode 100644 index 00000000..d4d34c7f --- /dev/null +++ b/seminar/migrations/0021_cislo_verejna_vysledkovka.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0020_indexy_a_razeni'), + ] + + operations = [ + migrations.AddField( + model_name='cislo', + name='verejna_vysledkovka', + field=models.BooleanField(default=False, help_text='Je-li false u ve\u0159ejn\xe9ho \u010d\xedsla, nen\xed v\xfdsledkovka zat\xedm ve\u0159ejn\xe1.', verbose_name='zve\u0159ejn\u011bna v\xfdsledkovka'), + preserve_default=True, + ), + ] diff --git a/seminar/migrations/0022_decimal_body.py b/seminar/migrations/0022_decimal_body.py new file mode 100644 index 00000000..ff92fcde --- /dev/null +++ b/seminar/migrations/0022_decimal_body.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals +import importlib + +from django.db import models, migrations + +migration_0022 = importlib.import_module('seminar.migrations.0002_add_body_views') + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0021_cislo_verejna_vysledkovka'), + ] + operations = [ + migrations.RunSQL(migration_0022.DROP_VIEWS), + migrations.AlterField( + model_name='problem', + name='body', + field=models.DecimalField(null=True, verbose_name='maximum bod\u016f', max_digits=8, decimal_places=1, blank=True), + preserve_default=True, + ), + migrations.AlterField( + model_name='reseni', + name='body', + field=models.DecimalField(null=True, verbose_name='body', max_digits=8, decimal_places=1, blank=True), + preserve_default=True, + ), + migrations.RunSQL(migration_0022.CREATE_VIEWS), + ] diff --git a/seminar/migrations/0023_add_novinky.py b/seminar/migrations/0023_add_novinky.py new file mode 100644 index 00000000..7db2a005 --- /dev/null +++ b/seminar/migrations/0023_add_novinky.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +from django.conf import settings + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('seminar', '0022_decimal_body'), + ] + + operations = [ + migrations.CreateModel( + name='Novinky', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('datum', models.DateField(auto_now_add=True)), + ('text', models.TextField(null=True, verbose_name=b'Text novinky', blank=True)), + ('obrazek', models.ImageField(upload_to=b'image_novinky/%Y/%m/%d/', null=True, verbose_name=b'Obr\xc3\xa1zek', blank=True)), + ('zverejneno', models.BooleanField(default=False, verbose_name=b'Zve\xc5\x99ejn\xc4\x9bno')), + ('autor', models.ForeignKey(verbose_name=b'Autor novinky', to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)) + ], + options={ + 'verbose_name': 'Novinka', + 'verbose_name_plural': 'Novinky', + }, + bases=(models.Model,), + ), + ] diff --git a/seminar/migrations/0024_add_organizator.py b/seminar/migrations/0024_add_organizator.py new file mode 100644 index 00000000..16faee72 --- /dev/null +++ b/seminar/migrations/0024_add_organizator.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +from django.conf import settings + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('seminar', '0023_add_novinky'), + ] + + operations = [ + migrations.CreateModel( + name='Organizator', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('prezdivka', models.CharField(max_length=32, null=True, verbose_name=b'P\xc5\x99ezd\xc3\xadvka', blank=True)), + ('organizuje_od_roku', models.IntegerField(null=True, verbose_name=b'Organizuje od roku', blank=True)), + ('organizuje_do_roku', models.IntegerField(null=True, verbose_name=b'Organizuje do roku', blank=True)), + ('studuje', models.CharField(max_length=256, null=True, verbose_name=b'Studuje', blank=True)), + ('strucny_popis_organizatora', models.TextField(null=True, verbose_name=b'Stru\xc4\x8dn\xc3\xbd popis organiz\xc3\xa1tora', blank=True)), + ('foto', models.ImageField(help_text=b'Vlo\xc5\xbe fotografii organiz\xc3\xa1tora o libovon\xc3\xa9 velikosti', upload_to=b'image_organizatori/%Y/', null=True, verbose_name=b'Fotografie organiz\xc3\xa1tora', blank=True)), + ('foto_male', models.ImageField(upload_to=b'image_organizatori/male/%Y/', null=True, editable=False, blank=True)), + ('user', models.OneToOneField(verbose_name=b'Osoba', to=settings.AUTH_USER_MODEL, help_text=b'Vyber \xc3\xba\xc4\x8det sp\xc5\x99a\xc5\xbeen\xc3\xbd s organiz\xc3\xa1torem.',on_delete=models.CASCADE)), + ], + options={ + 'verbose_name': 'Organiz\xe1tor', + 'verbose_name_plural': 'Organiz\xe1to\u0159i', + }, + bases=(models.Model,), + ), + ] diff --git a/seminar/migrations/0025_zmena_cesty_nahravani_obrazku.py b/seminar/migrations/0025_zmena_cesty_nahravani_obrazku.py new file mode 100644 index 00000000..23e02c95 --- /dev/null +++ b/seminar/migrations/0025_zmena_cesty_nahravani_obrazku.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0024_add_organizator'), + ] + + operations = [ + migrations.AlterField( + model_name='organizator', + name='foto', + field=models.ImageField(help_text=b'Vlo\xc5\xbe fotografii organiz\xc3\xa1tora o libovon\xc3\xa9 velikosti', upload_to=b'image_organizatori/velke/%Y/', null=True, verbose_name=b'Fotografie organiz\xc3\xa1tora', blank=True), + preserve_default=True, + ), + ] diff --git a/seminar/migrations/0026_soustredeni_typ.py b/seminar/migrations/0026_soustredeni_typ.py new file mode 100644 index 00000000..46d3416f --- /dev/null +++ b/seminar/migrations/0026_soustredeni_typ.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0025_zmena_cesty_nahravani_obrazku'), + ] + + operations = [ + migrations.AddField( + model_name='soustredeni', + name='typ', + field=models.CharField(default=b'podzimni', max_length=16, verbose_name='typ akce', choices=[(b'jarni', 'Jarn\xed soust\u0159ed\u011bn\xed'), (b'podzimni', 'Podzimn\xed soust\u0159ed\u011bn\xed'), (b'sraz', 'Nepravideln\xfd sraz')]), + preserve_default=True, + ), + ] diff --git a/seminar/migrations/0027_export_flag_a_typ_akce.py b/seminar/migrations/0027_export_flag_a_typ_akce.py new file mode 100644 index 00000000..e7172dcc --- /dev/null +++ b/seminar/migrations/0027_export_flag_a_typ_akce.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0026_soustredeni_typ'), + ] + + operations = [ + migrations.AddField( + model_name='rocnik', + name='exportovat', + field=models.BooleanField(default=False, help_text='Exportuje se jen podle tohoto flagu (ne ve\u0159ejnosti), a to jen \u010d\xedsla s ve\u0159ejnou v\xfdsledkovkou', verbose_name='export do AESOPa', db_column='exportovat'), + preserve_default=True, + ), + migrations.AddField( + model_name='soustredeni', + name='exportovat', + field=models.BooleanField(default=False, help_text='Exportuje se jen podle tohoto flagu (ne ve\u0159ejnosti)', verbose_name='export do AESOPa', db_column='exportovat'), + preserve_default=True, + ), + migrations.AlterField( + model_name='soustredeni', + name='typ', + field=models.CharField(default=b'podzimni', max_length=16, verbose_name='typ akce', choices=[(b'jarni', 'Jarn\xed soust\u0159ed\u011bn\xed'), (b'podzimni', 'Podzimn\xed soust\u0159ed\u011bn\xed'), (b'vikend', 'V\xedkendov\xfd sraz')]), + preserve_default=True, + ), + ] diff --git a/seminar/migrations/0028_add_body_celkem_views.py b/seminar/migrations/0028_add_body_celkem_views.py new file mode 100644 index 00000000..0f6799f0 --- /dev/null +++ b/seminar/migrations/0028_add_body_celkem_views.py @@ -0,0 +1,75 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +import django_countries.fields +import seminar.models +import django.utils.timezone +from django.conf import settings + +CREATE_VIEWS=""" +drop view seminar_body_k_cislu; +drop view seminar_body_za_cislo; + +create view seminar_body_za_cislo as + select + seminar_reseni.cislo_body_id || '-' || seminar_reseni.resitel_id as id, + seminar_reseni.cislo_body_id as cislo_id, + seminar_reseni.resitel_id as resitel_id, + seminar_cisla.cislo as cislo, + seminar_cisla.rocnik_id as rocnik_id, + seminar_rocniky.rocnik as rocnik, + seminar_cisla.verejna_vysledkovka as verejna_vysledkovka, + sum(seminar_reseni.body) as body + from + seminar_reseni + inner join seminar_cisla on seminar_reseni.cislo_body_id = seminar_cisla.id + inner join seminar_rocniky on seminar_cisla.rocnik_id = seminar_rocniky.id + group by seminar_reseni.cislo_body_id, seminar_reseni.resitel_id, seminar_cisla.cislo, + seminar_cisla.rocnik_id, seminar_rocniky.rocnik, seminar_cisla.verejna_vysledkovka + order by body desc; + +create view seminar_body_k_cislu_rocnik as + select + akt_body.id as id, + akt_body.cislo_id as cislo_id, + akt_body.resitel_id as resitel_id, + akt_body.body as body, + sum(min_body.body) as body_celkem + from + seminar_body_za_cislo as akt_body + inner join seminar_body_za_cislo as min_body on + (akt_body.resitel_id = min_body.resitel_id and + (akt_body.rocnik = min_body.rocnik and akt_body.cislo >= min_body.cislo) + ) + group by akt_body.id, akt_body.cislo_id, akt_body.resitel_id, akt_body.body + order by body_celkem desc; + +create view seminar_body_k_cislu_odjakziva as + select + akt_body.id as id, + akt_body.cislo_id as cislo_id, + akt_body.resitel_id as resitel_id, + akt_body.body as body, + sum(min_body.body) as body_celkem + from + seminar_body_za_cislo as akt_body + inner join seminar_body_za_cislo as min_body on + (akt_body.resitel_id = min_body.resitel_id and + ((akt_body.rocnik = min_body.rocnik and akt_body.cislo >= min_body.cislo) or + (akt_body.rocnik < min_body.rocnik) + ) + ) + group by akt_body.id, akt_body.cislo_id, akt_body.resitel_id, akt_body.body + order by body_celkem desc; + +""" + +class Migration(migrations.Migration): + + dependencies = [("seminar", "0027_export_flag_a_typ_akce")] + + operations = [ + migrations.RunSQL(sql=CREATE_VIEWS) + ] + diff --git a/seminar/migrations/0029_fix_body_celkem_views.py b/seminar/migrations/0029_fix_body_celkem_views.py new file mode 100644 index 00000000..5e287747 --- /dev/null +++ b/seminar/migrations/0029_fix_body_celkem_views.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +import django_countries.fields +import seminar.models +import django.utils.timezone +from django.conf import settings + +CREATE_VIEWS=""" + +drop view seminar_body_k_cislu_rocnik; +create view seminar_body_k_cislu_rocnik as + select + seminar_cisla.id || '-' || min_body.resitel_id as id, + seminar_cisla.id as cislo_id, + min_body.resitel_id as resitel_id, + sum(min_body.body) as body + from + seminar_cisla + inner join seminar_body_za_cislo as min_body on + (min_body.rocnik_id = seminar_cisla.rocnik_id and seminar_cisla.cislo >= min_body.cislo) + group by seminar_cisla.id, min_body.resitel_id + order by body desc; + +drop view seminar_body_k_cislu_odjakziva; +create view seminar_body_k_cislu_odjakziva as + select + seminar_cisla.id || '-' || min_body.resitel_id as id, + seminar_cisla.id as cislo_id, + min_body.resitel_id as resitel_id, + sum(min_body.body) as body + from + seminar_cisla + inner join seminar_rocniky on + (seminar_cisla.rocnik_id = seminar_rocniky.id) + inner join seminar_body_za_cislo as min_body on + (min_body.rocnik_id = seminar_cisla.rocnik_id and seminar_cisla.cislo >= min_body.cislo) or + (min_body.rocnik < seminar_rocniky.rocnik) + group by seminar_cisla.id, min_body.resitel_id + order by body desc; +""" + +class Migration(migrations.Migration): + + dependencies = [("seminar", "0028_add_body_celkem_views")] + + operations = [ + migrations.RunSQL(sql=CREATE_VIEWS) + ] + diff --git a/seminar/migrations/0030_add_vysledky.py b/seminar/migrations/0030_add_vysledky.py new file mode 100644 index 00000000..06842c6b --- /dev/null +++ b/seminar/migrations/0030_add_vysledky.py @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0029_fix_body_celkem_views'), + ] + + operations = [ + migrations.CreateModel( + name='VysledkyCelkemKCislu', + fields=[ + ('dummy_id', models.CharField(max_length=32, serialize=False, verbose_name='dummy ID pro view', primary_key=True, db_column=b'id')), + ('body', models.DecimalField(decimal_places=1, verbose_name='body za \u010d\xedslo', max_digits=8, db_column=b'body')), + ('body_celkem', models.DecimalField(decimal_places=1, verbose_name='body celkem do \u010d\xedsla v\u010detn\u011b minul\xfdch ro\u010dn\xedk\u016f', max_digits=8, db_column=b'body_celkem')), + ], + options={ + 'abstract': False, + 'db_table': 'seminar_body_celkem_k_cislu', + 'managed': False, + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='VysledkyKCisluOdjakziva', + fields=[ + ('dummy_id', models.CharField(max_length=32, serialize=False, verbose_name='dummy ID pro view', primary_key=True, db_column=b'id')), + ('body', models.DecimalField(decimal_places=1, verbose_name='body za \u010d\xedslo', max_digits=8, db_column=b'body')), + ], + options={ + 'abstract': False, + 'db_table': 'seminar_body_k_cislu_odjakziva', + 'managed': False, + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='VysledkyKCisluZaRocnik', + fields=[ + ('dummy_id', models.CharField(max_length=32, serialize=False, verbose_name='dummy ID pro view', primary_key=True, db_column=b'id')), + ('body', models.DecimalField(decimal_places=1, verbose_name='body za \u010d\xedslo', max_digits=8, db_column=b'body')), + ], + options={ + 'abstract': False, + 'db_table': 'seminar_body_k_cislu_rocnik', + 'managed': False, + }, + bases=(models.Model,), + ), + migrations.AlterField( + model_name='organizator', + name='foto', + field=models.ImageField(help_text=b'Vlo\xc5\xbe fotografii organiz\xc3\xa1tora o libovoln\xc3\xa9 velikosti', upload_to=b'image_organizatori/velke/%Y/', null=True, verbose_name=b'Fotografie organiz\xc3\xa1tora', blank=True), + preserve_default=True, + ), + ] diff --git a/seminar/migrations/0031_cislo_pdf.py b/seminar/migrations/0031_cislo_pdf.py new file mode 100644 index 00000000..c51570bf --- /dev/null +++ b/seminar/migrations/0031_cislo_pdf.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +import seminar.models + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0030_add_vysledky'), + ] + + operations = [ + migrations.AddField( + model_name='cislo', + name='pdf', + field=models.FileField(help_text='Pdf \u010d\xedsla, kter\xe9 si mohou \u0159e\u0161itel\xe9 st\xe1hnout', upload_to=seminar.models.cislo_pdf_filename, null=True, verbose_name='pdf'), + preserve_default=True, + ), + ] diff --git a/seminar/migrations/0032_cislo_pdf_blank_typos.py b/seminar/migrations/0032_cislo_pdf_blank_typos.py new file mode 100644 index 00000000..b16c4501 --- /dev/null +++ b/seminar/migrations/0032_cislo_pdf_blank_typos.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +import django_countries.fields +import seminar.models + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0031_cislo_pdf'), + ] + + operations = [ + migrations.AlterModelOptions( + name='soustredeni', + options={'ordering': ['-rocnik__rocnik', '-datum_zacatku'], 'verbose_name': 'Soust\u0159ed\u011bn\xed', 'verbose_name_plural': 'Soust\u0159ed\u011bn\xed'}, + ), + migrations.AlterField( + model_name='cislo', + name='cislo', + field=models.CharField(help_text='V\u011bt\u0161inou jen "1", vyj\xedme\u010dn\u011b "7-8", lexikograficky ur\u010duje po\u0159ad\xed v ro\u010dn\xedku!', max_length=32, verbose_name='n\xe1zev \u010d\xedsla', db_index=True), + preserve_default=True, + ), + migrations.AlterField( + model_name='cislo', + name='pdf', + field=models.FileField(help_text='Pdf \u010d\xedsla, kter\xe9 si mohou \u0159e\u0161itel\xe9 st\xe1hnout', upload_to=seminar.models.cislo_pdf_filename, null=True, verbose_name='pdf', blank=True), + preserve_default=True, + ), + migrations.AlterField( + model_name='problem', + name='typ', + field=models.CharField(default=b'uloha', max_length=32, verbose_name='typ probl\xe9mu', choices=[(b'uloha', '\xdaloha'), (b'tema', 'T\xe9ma'), (b'serial', 'Seri\xe1l'), (b'org-clanek', 'Organiz\xe1torsk\xfd \u010dl\xe1nek'), (b'res-clanek', '\u0158e\u0161itelsk\xfd \u010dl\xe1nek')]), + preserve_default=True, + ), + migrations.AlterField( + model_name='skola', + name='stat', + field=django_countries.fields.CountryField(default=b'CZ', help_text='ISO 3166-1 k\xf3d zem\u011b velk\xfdmi p\xedsmeny (CZ, SK, ...)', max_length=2, verbose_name='st\xe1t'), + preserve_default=True, + ), + ] diff --git a/seminar/migrations/0033_organizator_studuje_popisek.py b/seminar/migrations/0033_organizator_studuje_popisek.py new file mode 100644 index 00000000..07f15712 --- /dev/null +++ b/seminar/migrations/0033_organizator_studuje_popisek.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0032_cislo_pdf_blank_typos'), + ] + + operations = [ + migrations.AlterField( + model_name='organizator', + name='studuje', + field=models.CharField(help_text=b"Nap\xc5\x99. 'Studuje Obecnou fyziku (Bc.), 3. ro\xc4\x8dn\xc3\xadk', 'Vystudovala Diskr\xc3\xa9tn\xc3\xad modely a algoritmy (Mgr.)' nebo 'P\xc5\x99edn\xc3\xa1\xc5\xa1\xc3\xad na MFF'", max_length=256, null=True, verbose_name=b'Studium aj.', blank=True), + preserve_default=True, + ), + ] diff --git a/seminar/migrations/0034_reseni_forma_default_email.py b/seminar/migrations/0034_reseni_forma_default_email.py new file mode 100644 index 00000000..2d691b30 --- /dev/null +++ b/seminar/migrations/0034_reseni_forma_default_email.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0033_organizator_studuje_popisek'), + ] + + operations = [ + migrations.AlterField( + model_name='reseni', + name='forma', + field=models.CharField(default=b'email', max_length=16, verbose_name='forma \u0159e\u0161en\xed', choices=[(b'papir', 'Pap\xedrov\xe9 \u0159e\u0161en\xed'), (b'email', 'Emailem'), (b'upload', 'Upload p\u0159es web')]), + preserve_default=True, + ), + ] diff --git a/seminar/migrations/0035_django_imagekit.py b/seminar/migrations/0035_django_imagekit.py new file mode 100644 index 00000000..dd443018 --- /dev/null +++ b/seminar/migrations/0035_django_imagekit.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +import imagekit.models.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0034_reseni_forma_default_email'), + ] + + operations = [ + migrations.RemoveField( + model_name='organizator', + name='foto_male', + ), + migrations.AlterField( + model_name='organizator', + name='foto', + field=imagekit.models.fields.ProcessedImageField(help_text=b'Vlo\xc5\xbe fotografii organiz\xc3\xa1tora o libovoln\xc3\xa9 velikosti', upload_to=b'image_organizatori/velke/%Y/', null=True, verbose_name=b'Fotografie organiz\xc3\xa1tora', blank=True), + preserve_default=True, + ), + ] diff --git a/seminar/migrations/0036_add_org_to_soustredeni.py b/seminar/migrations/0036_add_org_to_soustredeni.py new file mode 100644 index 00000000..4db43239 --- /dev/null +++ b/seminar/migrations/0036_add_org_to_soustredeni.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0035_django_imagekit'), + ] + + operations = [ + migrations.CreateModel( + name='Soustredeni_Organizatori', + fields=[ + ('id', models.AutoField(serialize=False, primary_key=True)), + ('poznamka', models.TextField(help_text='Neve\u0159ejn\xe1 pozn\xe1mka k \xfa\u010dasti organiz\xe1tora (plain text)', verbose_name='neve\u0159ejn\xe1 pozn\xe1mka', blank=True)), + ('organizator', models.ForeignKey(verbose_name='organiz\xe1tor', to='seminar.Organizator', on_delete=models.CASCADE)), + ('soustredeni', models.ForeignKey(verbose_name='soust\u0159ed\u011bn\xed', to='seminar.Soustredeni', on_delete=models.CASCADE)), + ], + options={ + 'ordering': ['soustredeni', 'organizator'], + 'db_table': 'seminar_soustredeni_organizatori', + 'verbose_name': '\xda\u010dast organiz\xe1tor\u016f na soust\u0159ed\u011bn\xed', + 'verbose_name_plural': '\xda\u010dasti organiz\xe1tor\u016f na soust\u0159ed\u011bn\xed', + }, + bases=(models.Model,), + ), + migrations.AddField( + model_name='soustredeni', + name='organizatori', + field=models.ManyToManyField(help_text='Seznam organiz\xe1tor\u016f soust\u0159ed\u011bn\xed', to='seminar.Organizator', verbose_name='Organiz\xe1to\u0159i soust\u0159ed\u011bn\xed', through='seminar.Soustredeni_Organizatori'), + preserve_default=True, + ), + ] diff --git a/seminar/migrations/0037_prispevek.py b/seminar/migrations/0037_prispevek.py new file mode 100644 index 00000000..c4c3b867 --- /dev/null +++ b/seminar/migrations/0037_prispevek.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0036_add_org_to_soustredeni'), + ] + + operations = [ + migrations.CreateModel( + name='Prispevek', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('nazev', models.CharField(max_length=200, verbose_name=b'N\xc3\xa1zev')), + ('text_org', models.TextField(null=True, verbose_name=b'Orgovsk\xc3\xbd text', blank=True)), + ('text_resitel', models.TextField(null=True, verbose_name=b'\xc5\x98e\xc5\xa1itelsk\xc3\xbd text', blank=True)), + ('zverejnit', models.BooleanField(verbose_name=b'Zve\xc5\x99ejnit?')), + ('problem', models.ForeignKey(verbose_name=b'Probl\xc3\xa9m', to='seminar.Problem', on_delete=models.CASCADE)), + ('reseni', models.OneToOneField(null=True, blank=True, to='seminar.Reseni', verbose_name=b'\xc5\x98e\xc5\xa1en\xc3\xad', on_delete=models.CASCADE)), + ], + options={ + 'abstract': False, + }, + ), + ] diff --git a/seminar/migrations/0038_change_meta_prispevek.py b/seminar/migrations/0038_change_meta_prispevek.py new file mode 100644 index 00000000..5378e57e --- /dev/null +++ b/seminar/migrations/0038_change_meta_prispevek.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0037_prispevek'), + ] + + operations = [ + migrations.AlterModelOptions( + name='prispevek', + options={'verbose_name': 'P\u0159\xedsp\u011bvek k probl\xe9mu', 'verbose_name_plural': 'P\u0159\xedsp\u011bvky k probl\xe9m\u016fm'}, + ), + ] diff --git a/seminar/migrations/0039_pohadka.py b/seminar/migrations/0039_pohadka.py new file mode 100644 index 00000000..f798bd75 --- /dev/null +++ b/seminar/migrations/0039_pohadka.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models +import django.utils.timezone +from django.conf import settings + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('seminar', '0038_change_meta_prispevek'), + ] + + operations = [ + migrations.CreateModel( + name='Pohadka', + fields=[ + ('id', models.AutoField(serialize=False, primary_key=True)), + ('text', models.TextField(verbose_name='Text poh\xe1dky')), + ('pred', models.BooleanField(default=True, verbose_name='P\u0159ed \xfalohou')), + ('timestamp', models.DateTimeField(default=django.utils.timezone.now, verbose_name='Vytvo\u0159eno', editable=False, blank=True)), + ('autor', models.ForeignKey(verbose_name=b'Autor poh\xc3\xa1dky', to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)), + ('uloha', models.ForeignKey(related_name='pohadky', verbose_name='\xdaloha', to='seminar.Problem',on_delete=models.CASCADE)), + ], + options={ + 'ordering': ['uloha__cislo_zadani', 'uloha__kod', '-pred'], + 'db_table': 'seminar_pohadky', + 'verbose_name': 'Poh\xe1dka', + 'verbose_name_plural': 'Poh\xe1dky', + }, + ), + ] diff --git a/seminar/migrations/0040_pohadka_nepovinny_autor.py b/seminar/migrations/0040_pohadka_nepovinny_autor.py new file mode 100644 index 00000000..babf9b24 --- /dev/null +++ b/seminar/migrations/0040_pohadka_nepovinny_autor.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models +from django.conf import settings + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0039_pohadka'), + ] + + operations = [ + migrations.AlterField( + model_name='pohadka', + name='autor', + field=models.ForeignKey(verbose_name=b'Autor poh\xc3\xa1dky', to=settings.AUTH_USER_MODEL, null=True, on_delete=models.CASCADE), + ), + ] diff --git a/seminar/migrations/0041_konfery.py b/seminar/migrations/0041_konfery.py new file mode 100644 index 00000000..9fddbe17 --- /dev/null +++ b/seminar/migrations/0041_konfery.py @@ -0,0 +1,71 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion +import seminar.models + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0040_pohadka_nepovinny_autor'), + ] + + operations = [ + migrations.CreateModel( + name='Konfera', + fields=[ + ('id', models.AutoField(serialize=False, primary_key=True)), + ('nazev', models.CharField(help_text='N\xe1zev konfery', max_length=40, verbose_name='n\xe1zev konfery')), + ('popis', models.TextField(help_text='Popis konfery k zobrazen\xed na webu', verbose_name='popis konfery', blank=True)), + ('abstrakt', models.TextField(help_text='Abstrakt konfery tak, jak byl uveden ve sborn\xedku', verbose_name='abstrakt', blank=True)), + ('org_poznamka', models.TextField(help_text='Neve\u0159ejn\xe1 pozn\xe1mka ke konfe\u0159e(plain text)', verbose_name='neve\u0159ejn\xe1 pozn\xe1mka', blank=True)), + ('typ_prezentace', models.CharField(default=b'veletrh', max_length=16, verbose_name='typ prezentace', choices=[(b'veletrh', 'Veletrh (postery)'), (b'prezentace', 'Prezentace (p\u0159edn\xe1\u0161ka)')])), + ('prezentace', models.FileField(help_text='Prezentace nebo fotka posteru', upload_to=seminar.models.generate_filename_konfera, verbose_name='prezentace')), + ('materialy', models.FileField(help_text='Dal\u0161\xed materi\xe1ly ke konfe\u0159e zabalen\xe9 do jednoho souboru', upload_to=seminar.models.generate_filename_konfera, verbose_name='materialy')), + ('organizator', models.ForeignKey(related_name='konfery', on_delete=django.db.models.deletion.SET_NULL, verbose_name='organiz\xe1tor', to='seminar.Organizator', null=True)), + ], + options={ + 'db_table': 'seminar_konfera', + 'verbose_name': 'Konfera', + 'verbose_name_plural': 'Konfery', + }, + ), + migrations.CreateModel( + name='Konfery_Ucastnici', + fields=[ + ('id', models.AutoField(serialize=False, primary_key=True)), + ('poznamka', models.TextField(help_text='Neve\u0159ejn\xe1 pozn\xe1mka k \xfa\u010dasti (plain text)', verbose_name='neve\u0159ejn\xe1 pozn\xe1mka', blank=True)), + ('konfera', models.ForeignKey(verbose_name='konfera', to='seminar.Konfera', + on_delete=models.PROTECT)), + ('resitel', models.ForeignKey(verbose_name='\u0159e\u0161itel', to='seminar.Resitel',on_delete=models.CASCADE)), + ], + options={ + 'ordering': ['konfera', 'resitel'], + 'db_table': 'seminar_konfery_ucastnici', + 'verbose_name': '\xda\u010dast na konfe\u0159e', + 'verbose_name_plural': '\xda\u010dasti na konfe\u0159e', + }, + ), + migrations.AlterField( + model_name='problem', + name='typ', + field=models.CharField(default=b'uloha', max_length=32, verbose_name='typ probl\xe9mu', choices=[(b'uloha', '\xdaloha'), (b'tema', 'T\xe9ma'), (b'serial', 'Seri\xe1l'), (b'konfera', 'Konfera'), (b'org-clanek', 'Organiz\xe1torsk\xfd \u010dl\xe1nek'), (b'res-clanek', '\u0158e\u0161itelsk\xfd \u010dl\xe1nek')]), + ), + migrations.AddField( + model_name='konfera', + name='prispevek', + field=models.ForeignKey(related_name='konfery', on_delete=django.db.models.deletion.SET_NULL, verbose_name='p\u0159\xedsp\u011bvek do \u010d\xedsla', to='seminar.Problem', help_text='\xda\u010dastnick\xfd p\u0159\xedp\u011bvek o konfe\u0159e', null=True), + ), + migrations.AddField( + model_name='konfera', + name='soustredeni', + field=models.ForeignKey(related_name='konfery', on_delete=django.db.models.deletion.SET_NULL, verbose_name='soust\u0159ed\u011bn\xed', to='seminar.Soustredeni', null=True), + ), + migrations.AddField( + model_name='konfera', + name='ucastnici', + field=models.ManyToManyField(help_text='Seznam \xfa\u010dastn\xedk\u016f konfery', to='seminar.Resitel', verbose_name='\xfa\u010dastn\xedci konfery', through='seminar.Konfery_Ucastnici'), + ), + ] diff --git a/seminar/migrations/0042_auto_20161005_0847.py b/seminar/migrations/0042_auto_20161005_0847.py new file mode 100644 index 00000000..27930952 --- /dev/null +++ b/seminar/migrations/0042_auto_20161005_0847.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion +import seminar.models + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0041_konfery'), + ] + + operations = [ + migrations.AlterField( + model_name='konfera', + name='materialy', + field=models.FileField(help_text='Dal\u0161\xed materi\xe1ly ke konfe\u0159e zabalen\xe9 do jednoho souboru', upload_to=seminar.models.generate_filename_konfera, verbose_name='materialy', blank=True), + ), + migrations.AlterField( + model_name='konfera', + name='prezentace', + field=models.FileField(help_text='Prezentace nebo fotka posteru', upload_to=seminar.models.generate_filename_konfera, verbose_name='prezentace', blank=True), + ), + migrations.AlterField( + model_name='konfera', + name='prispevek', + field=models.ForeignKey(related_name='konfery', on_delete=django.db.models.deletion.SET_NULL, blank=True, to='seminar.Problem', help_text='\xda\u010dastnick\xfd p\u0159\xedp\u011bvek o konfe\u0159e', null=True, verbose_name='p\u0159\xedsp\u011bvek do \u010d\xedsla'), + ), + ] diff --git a/seminar/migrations/0042_cislo_faze.py b/seminar/migrations/0042_cislo_faze.py new file mode 100644 index 00000000..7d35ace5 --- /dev/null +++ b/seminar/migrations/0042_cislo_faze.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0041_konfery'), + ] + + operations = [ + migrations.AddField( + model_name='cislo', + name='faze', + field=models.CharField(default='admin', help_text='B\u011bhem f\xe1ze "admin" se obsah \u010d\xedsla vytv\xe1\u0159\xed (a p\u0159\xedpadn\u011b komentuje) ve webov\xe9m rozhran\xed. B\u011bhem f\xe1ze "tex" u\u017e obsah ve webov\xe9m rozhran\xed editovat nelze. N\xe1vrhy na \xfapravy se pak p\xed\u0161\xed do korekturov\xe1tka a zan\xe1\u0161ej\xed do gitu. Z n\u011bj se pak generuje verze pro web.', max_length=32, verbose_name='F\xe1ze vytv\xe1\u0159en\xed obsahu'), + ), + ] diff --git a/seminar/migrations/0043_uprava_faze.py b/seminar/migrations/0043_uprava_faze.py new file mode 100644 index 00000000..29e06e01 --- /dev/null +++ b/seminar/migrations/0043_uprava_faze.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0042_cislo_faze'), + ] + + operations = [ + migrations.AlterField( + model_name='cislo', + name='faze', + field=models.CharField(default='admin', help_text='B\u011bhem f\xe1ze "admin" se obsah \u010d\xedsla vytv\xe1\u0159\xed (a p\u0159\xedpadn\u011b komentuje) ve webov\xe9m rozhran\xed. B\u011bhem f\xe1ze "tex" u\u017e obsah ve webov\xe9m rozhran\xed editovat nelze. N\xe1vrhy na \xfapravy se pak p\xed\u0161\xed do korekturov\xe1tka a zan\xe1\u0161ej\xed do gitu. Z n\u011bj se pak generuje verze pro web.', max_length=32, verbose_name='F\xe1ze vytv\xe1\u0159en\xed obsahu', choices=[('admin', 'Zad\xe1v\xe1n\xed \xfaloh do webu'), ('tex', '\xdapravy \xfaloh v TeXov\xe9m repozit\xe1\u0159i')]), + ), + ] diff --git a/seminar/migrations/0044_uprava_faze.py b/seminar/migrations/0044_uprava_faze.py new file mode 100644 index 00000000..0d683d6c --- /dev/null +++ b/seminar/migrations/0044_uprava_faze.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0043_uprava_faze'), + ] + + operations = [ + migrations.AlterField( + model_name='cislo', + name='faze', + field=models.CharField(default='admin', help_text='B\u011bhem f\xe1ze "\xdapravy na webu" se obsah \u010d\xedsla vytv\xe1\u0159\xed (a p\u0159\xedpadn\u011b komentuje) ve webov\xe9m rozhran\xed. B\u011bhem f\xe1ze "\xdapravy na webu" u\u017e obsah ve webov\xe9m rozhran\xed editovat nelze a n\xe1vrhy na \xfapravy se p\xed\u0161\xed do korekturov\xe1tka a zan\xe1\u0161ej\xed do gitu. Z n\u011bj se pak generuje verze pro web.', max_length=32, verbose_name='F\xe1ze vytv\xe1\u0159en\xed obsahu', choices=[('admin', '\xdapravy na webu'), ('tex', '\xdapravy v TeXu')]), + ), + ] diff --git a/seminar/migrations/0045_cislo_pridani_faze_nahrano.py b/seminar/migrations/0045_cislo_pridani_faze_nahrano.py new file mode 100644 index 00000000..06ca8201 --- /dev/null +++ b/seminar/migrations/0045_cislo_pridani_faze_nahrano.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0044_uprava_faze'), + ] + + operations = [ + migrations.AlterField( + model_name='cislo', + name='faze', + field=models.CharField(default='admin', help_text='B\u011bhem f\xe1ze "\xdapravy na webu" se obsah \u010d\xedsla vytv\xe1\u0159\xed (a p\u0159\xedpadn\u011b komentuje) ve webov\xe9m rozhran\xed. B\u011bhem f\xe1ze "\xdapravy v TeXu" u\u017e obsah ve webov\xe9m rozhran\xed editovat nelze a n\xe1vrhy na \xfapravy se p\xed\u0161\xed do korekturov\xe1tka a zan\xe1\u0161ej\xed do gitu. Z n\u011bj se pak vygeneruje verze pro web a \u010d\xedslo se p\u0159epne do f\xe1ze "Nahr\xe1no na web", co\u017e jen znamen\xe1, \u017ee u\u017e nejde automaticky st\xe1hnout obsah pro zalo\u017een\xed \u010d\xedsla v TeXu.', max_length=32, verbose_name='F\xe1ze vytv\xe1\u0159en\xed obsahu', choices=[('admin', '\xdapravy na webu'), ('tex', '\xdapravy v TeXu'), ('tex', 'Nahr\xe1no na web')]), + ), + ] diff --git a/seminar/migrations/0046_merge.py b/seminar/migrations/0046_merge.py new file mode 100644 index 00000000..19352440 --- /dev/null +++ b/seminar/migrations/0046_merge.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0042_auto_20161005_0847'), + ('seminar', '0045_cislo_pridani_faze_nahrano'), + ] + + operations = [ + ] diff --git a/seminar/migrations/0047_auto_20170120_2118.py b/seminar/migrations/0047_auto_20170120_2118.py new file mode 100644 index 00000000..1876fe25 --- /dev/null +++ b/seminar/migrations/0047_auto_20170120_2118.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0046_merge'), + ] + + operations = [ + migrations.AlterField( + model_name='cislo', + name='faze', + field=models.CharField(default='admin', help_text='B\u011bhem f\xe1ze "\xdapravy na webu" se obsah \u010d\xedsla vytv\xe1\u0159\xed (a p\u0159\xedpadn\u011b komentuje) ve webov\xe9m rozhran\xed. B\u011bhem f\xe1ze "\xdapravy v TeXu" u\u017e obsah ve webov\xe9m rozhran\xed editovat nelze a n\xe1vrhy na \xfapravy se p\xed\u0161\xed do korekturov\xe1tka a zan\xe1\u0161ej\xed do gitu. Z n\u011bj se pak vygeneruje verze pro web a \u010d\xedslo se p\u0159epne do f\xe1ze "Nahr\xe1no na web", co\u017e jen znamen\xe1, \u017ee u\u017e nejde automaticky st\xe1hnout obsah pro zalo\u017een\xed \u010d\xedsla v TeXu.', max_length=32, verbose_name='F\xe1ze vytv\xe1\u0159en\xed obsahu', choices=[('admin', '\xdapravy na webu'), ('tex', '\xdapravy v TeXu'), ('nahrano', 'Nahr\xe1no na web')]), + ), + ] diff --git a/seminar/migrations/0048_add_cislo_datum_deadline_soustredeni.py b/seminar/migrations/0048_add_cislo_datum_deadline_soustredeni.py new file mode 100644 index 00000000..134a00a8 --- /dev/null +++ b/seminar/migrations/0048_add_cislo_datum_deadline_soustredeni.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0047_auto_20170120_2118'), + ] + + operations = [ + migrations.AddField( + model_name='cislo', + name='datum_deadline_soustredeni', + field=models.DateField(help_text='Datum pro p\u0159\xedjem \u0159e\u0161en\xed pro \xfa\u010dast na soust\u0159ed\u011bn\xed', null=True, verbose_name='datum deadline soust\u0159ed\u011bn\xed', blank=True), + ), + ] diff --git a/seminar/migrations/0049_auto_20190430_2354.py b/seminar/migrations/0049_auto_20190430_2354.py new file mode 100644 index 00000000..de2b1b0d --- /dev/null +++ b/seminar/migrations/0049_auto_20190430_2354.py @@ -0,0 +1,508 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.20 on 2019-04-30 21:54 +from __future__ import unicode_literals + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion +import django.utils.timezone +import django_countries.fields +import imagekit.models.fields +import taggit.managers + + +class Migration(migrations.Migration): + atomic = False + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('seminar', '0048_add_cislo_datum_deadline_soustredeni'), + ] + + operations = [ + migrations.CreateModel( + name='Clanek', + fields=[ + ('problem_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='seminar.Problem')), + ], + options={ + 'verbose_name': 'Článek', + 'verbose_name_plural': 'Články', + 'db_table': 'seminar_clanky', + }, + bases=('seminar.problem',), + ), + migrations.CreateModel( + name='Hodnoceni', + fields=[ + ('id', models.AutoField(primary_key=True, serialize=False)), + ('body', models.DecimalField(decimal_places=1, max_digits=8, verbose_name='body')), + ], + options={ + 'verbose_name': 'Hodnocení', + 'verbose_name_plural': 'Hodnocení', + 'db_table': 'seminar_hodnoceni', + }, + ), + migrations.CreateModel( + name='Obrazek', + fields=[ + ('id', models.AutoField(primary_key=True, serialize=False)), + ('na_web', models.ImageField(blank=True, null=True, upload_to='obrazky/%Y/%m/%d/', verbose_name='obrázek na web')), + ('do_cisla_barevny', models.FileField(blank=True, help_text='Barevná verze obrázku do čísla', null=True, upload_to='obrazky/%Y/%m/%d/', verbose_name='barevný obrázek do čísla')), + ('do_cisla_cernobily', models.FileField(blank=True, help_text='Černobílá verze obrázku do čísla', null=True, upload_to='obrazky/%Y/%m/%d/', verbose_name='černobílý obrázek do čísla')), + ], + options={ + 'verbose_name': 'obrázek', + 'verbose_name_plural': 'obrázky', + 'db_table': 'seminar_obrazky', + }, + ), + migrations.CreateModel( + name='Osoba', + fields=[ + ('id', models.AutoField(primary_key=True, serialize=False)), + ('jmeno', models.CharField(max_length=256, verbose_name='jméno')), + ('prijmeni', models.CharField(max_length=256, verbose_name='příjmení')), + ('prezdivka', models.CharField(max_length=256, verbose_name='přezdívka')), + ('pohlavi_muz', models.BooleanField(default=False, verbose_name='pohlaví (muž)')), + ('email', models.EmailField(blank=True, default='', max_length=256, verbose_name='e-mail')), + ('telefon', models.CharField(blank=True, default='', max_length=256, verbose_name='telefon')), + ('datum_narozeni', models.DateField(blank=True, null=True, verbose_name='datum narození')), + ('datum_souhlasu_udaje', models.DateField(blank=True, help_text='Datum souhlasu se zpracováním osobních údajů', null=True, verbose_name='datum souhlasu (údaje)')), + ('datum_souhlasu_zasilani', models.DateField(blank=True, help_text='Datum souhlasu se zasíláním MFF materiálů', null=True, verbose_name='datum souhlasu (spam)')), + ('datum_registrace', models.DateField(default=django.utils.timezone.now, verbose_name='datum registrace do semináře')), + ('ulice', models.CharField(blank=True, default='', max_length=256, verbose_name='ulice')), + ('mesto', models.CharField(blank=True, default='', max_length=256, verbose_name='město')), + ('psc', models.CharField(blank=True, default='', max_length=32, verbose_name='PSČ')), + ('stat', django_countries.fields.CountryField(default='CZ', help_text='ISO 3166-1 kód země velkými písmeny (CZ, SK, ...)', max_length=2, verbose_name='stát')), + ('poznamka', models.TextField(blank=True, help_text='Neveřejná poznámka k osobě (plain text)', verbose_name='neveřejná poznámka')), + ('foto', imagekit.models.fields.ProcessedImageField(blank=True, help_text='Vlož fotografii osoby o libovolné velikosti', null=True, upload_to='image_osoby/velke/%Y/', verbose_name='Fotografie osoby')), + ('user', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='uživatel')), + ], + options={ + 'verbose_name': 'Osoba', + 'verbose_name_plural': 'Osoby', + 'db_table': 'seminar_osoby', + 'ordering': ['prijmeni', 'jmeno'], + }, + ), + migrations.CreateModel( + name='Prijemce', + fields=[ + ('id', models.AutoField(primary_key=True, serialize=False)), + ('poznamka', models.TextField(blank=True, help_text='Neveřejná poznámka k příemci čísel (plain text)', verbose_name='neveřejná poznámka')), + ('osoba', models.ForeignKey(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')), + ], + options={ + 'verbose_name': 'příjemce', + 'verbose_name_plural': 'příjemce', + 'db_table': 'seminar_prijemce', + }, + ), + migrations.CreateModel( + name='Reseni_Resitele', + fields=[ + ('id', models.AutoField(primary_key=True, serialize=False)), + ], + options={ + 'verbose_name': 'Řešení řešitelů', + 'verbose_name_plural': 'Řešení řešitelů', + 'db_table': 'seminar_reseni_resitele', + 'ordering': ['reseni', 'resitele'], + }, + ), + migrations.CreateModel( + name='Tema', + fields=[ + ('problem_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='seminar.Problem')), + ('tema_typ', models.CharField(choices=[('tema', 'Téma'), ('serial', 'Seriál')], default='tema', max_length=16, verbose_name='Typ tématu')), + ], + options={ + 'verbose_name': 'Téma', + 'verbose_name_plural': 'Témata', + 'db_table': 'seminar_temata', + }, + bases=('seminar.problem',), + ), + migrations.CreateModel( + name='Text', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('na_web', models.TextField(blank=True, help_text='Text ke zveřejnění na webu', verbose_name='text na web')), + ('do_cisla', models.TextField(blank=True, help_text='Text ke zveřejnění v čísle', verbose_name='text do čísla')), + ], + options={ + 'verbose_name': 'text', + 'verbose_name_plural': 'texty', + 'db_table': 'seminar_texty', + }, + ), + migrations.CreateModel( + name='Uloha', + fields=[ + ('problem_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='seminar.Problem')), + ('max_body', models.DecimalField(blank=True, decimal_places=1, max_digits=8, null=True, verbose_name='maximum bodů')), + ], + options={ + 'verbose_name': 'Úloha', + 'verbose_name_plural': 'Úlohy', + 'db_table': 'seminar_ulohy', + }, + bases=('seminar.problem',), + ), + migrations.AlterModelOptions( + name='novinky', + options={'ordering': ['-datum'], 'verbose_name': 'Novinka', 'verbose_name_plural': 'Novinky'}, + ), + migrations.AlterModelOptions( + name='prilohareseni', + options={'ordering': ['reseni', 'vytvoreno'], 'verbose_name': 'Příloha řešení', 'verbose_name_plural': 'Přílohy řešení'}, + ), + migrations.AlterModelOptions( + name='reseni', + options={'ordering': ['-cas_doruceni'], 'verbose_name': 'Řešení', 'verbose_name_plural': 'Řešení'}, + ), + migrations.AlterModelOptions( + name='resitel', + options={'ordering': ['osoba'], 'verbose_name': 'Řešitel', 'verbose_name_plural': 'Řešitelé'}, + ), + migrations.RenameField( + model_name='konfera', + old_name='org_poznamka', + new_name='poznamka', + ), + migrations.RenameField( + model_name='pohadka', + old_name='timestamp', + new_name='vytvoreno', + ), + migrations.RenameField( + model_name='reseni', + old_name='timestamp', + new_name='cas_doruceni', + ), + migrations.RenameField( + model_name='prilohareseni', + old_name='timestamp', + new_name='vytvoreno', + ), + migrations.RenameField( + model_name='problem', + old_name='text_org', + new_name='poznamka', + ), + migrations.RenameField( + model_name='problem', + old_name='timestamp', + new_name='vytvoreno', + ), + migrations.RenameField( + model_name='problem', + old_name='cislo_zadani', + new_name='cislo_zadani_old', + ), + migrations.RenameField( + model_name='problem', + old_name='cislo_reseni', + new_name='cislo_reseni_old', + ), + migrations.AddField( + model_name='konfera', + name='anotace', + field=models.TextField(blank=True, help_text='Popis, o čem bude konfera.', verbose_name='anotace'), + ), + migrations.AddField( + model_name='konfera', + name='reseni', + field=models.ForeignKey(blank=True, help_text='Účastnický přípěvek o konfeře', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='konfery', to='seminar.Reseni', verbose_name='článek ke konfeře'), + ), + migrations.AddField( + model_name='organizator', + name='organizuje_do', + field=models.DateTimeField(blank=True, null=True, verbose_name='Organizuje do'), + ), + migrations.AddField( + model_name='organizator', + name='organizuje_od', + field=models.DateTimeField(null=True,blank=True, verbose_name='Organizuje od'), + ), + migrations.AddField( + model_name='organizator', + name='skola', + field=models.CharField(blank=True, help_text='Škola, např. MFF, VŠCHT, VUT, ... prostě aby se nemuselo psát do studuješkolu, ale jen obor, možnost zobrazit zvlášť', max_length=256, null=True, verbose_name='Škola, kterou studuje'), + ), + migrations.AddField( + model_name='organizator', + name='vytvoreno', + field=models.DateTimeField(blank=True, default=django.utils.timezone.now, editable=False, verbose_name='Vytvořeno'), + ), + migrations.AddField( + model_name='problem', + name='garant', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='garant_problemu_problem', to='seminar.Organizator', verbose_name='garant zadaného problému'), + ), + migrations.AddField( + model_name='problem', + name='nadproblem', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='nadproblem_problem', to='seminar.Problem', verbose_name='nadřazený problém'), + ), + migrations.AddField( + model_name='problem', + name='opravovatele', + field=models.ManyToManyField(blank=True, related_name='opravovatele_problem', to='seminar.Organizator', verbose_name='opravovatelé'), + ), + migrations.AddField( + model_name='reseni', + name='zverejneno', + field=models.BooleanField(default=False, help_text='Udává, zda je řešení zveřejněno', verbose_name='řešení zveřejněno'), + ), + 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\t není výsledkovka zatím veřejná.', verbose_name='zveřejněna výsledkovka'), + ), + migrations.AlterField( + model_name='cislo', + name='verejne_db', + field=models.BooleanField(db_column='verejne', default=False, verbose_name='číslo zveřejněno'), + ), + migrations.AlterField( + model_name='konfera', + name='typ_prezentace', + field=models.CharField(choices=[('veletrh', 'Veletrh (postery)'), ('prezentace', 'Prezentace (přednáška)')], default='veletrh', max_length=16, verbose_name='typ prezentace'), + ), + migrations.RenameField( + model_name='novinky', + old_name='autor', + new_name='autor_old' + ), + migrations.AddField( + model_name='novinky', + name='autor', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='seminar.Organizator', verbose_name='Autor novinky', null=True), + ), + migrations.AlterField( + model_name='novinky', + name='obrazek', + field=models.ImageField(blank=True, null=True, upload_to='image_novinky/%Y/%m/%d/', verbose_name='Obrázek'), + ), + migrations.AlterField( + model_name='novinky', + name='text', + field=models.TextField(blank=True, null=True, verbose_name='Text novinky'), + ), + migrations.AlterField( + model_name='novinky', + name='zverejneno', + field=models.BooleanField(default=False, verbose_name='Zveřejněno'), + ), + migrations.AlterField( + model_name='organizator', + name='strucny_popis_organizatora', + field=models.TextField(blank=True, null=True, verbose_name='Stručný popis organizátora'), + ), + migrations.AlterField( + model_name='organizator', + name='studuje', + field=models.CharField(blank=True, help_text="Např. 'Studuje Obecnou fyziku (Bc.), 3. ročník', 'Vystudovala Diskrétní modely a algoritmy (Mgr.)' nebo 'Přednáší na MFF'", max_length=256, null=True, verbose_name='Studium aj.'), + ), + migrations.RenameField( + model_name='pohadka', + old_name='autor', + new_name='autor_old' + ), + migrations.AddField( + model_name='pohadka', + name='autor', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='seminar.Organizator', verbose_name='Autor pohádky'), + ), + migrations.RenameField( + model_name='pohadka', + old_name='uloha', + new_name='uloha_old' + ), + migrations.AddField( + model_name='pohadka', + name='uloha', + field=models.ForeignKey(null=True,on_delete=django.db.models.deletion.CASCADE, related_name='pohadky', to='seminar.Uloha', verbose_name='Úloha'), + ), + migrations.RenameField( + model_name='problem', + old_name='autor', + new_name='autor_old', + ), + migrations.AddField( + model_name='problem', + name='autor', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='autor_problemu_problem', to='seminar.Organizator', verbose_name='autor problému'), + ), + migrations.AlterField( + model_name='problem', + name='kod', + field=models.CharField(blank=True, default='', help_text='Číslo/kód úlohy v čísle nebo kód tématu/článku/seriálu v ročníku', max_length=32, verbose_name='lokální kód'), + ), + migrations.AlterField( + model_name='problem', + name='stav', + field=models.CharField(choices=[('navrh', 'Návrh'), ('zadany', 'Zadaný'), ('vyreseny', 'Vyřešený'), ('smazany', 'Smazaný')], default='navrh', max_length=32, verbose_name='stav problému'), + ), + migrations.AlterField( + model_name='problem', + name='zamereni', + field=taggit.managers.TaggableManager(blank=True, help_text='Zaměření M/F/I/O problému, příp. další tagy', through='taggit.TaggedItem', to='taggit.Tag', verbose_name='zaměření'), + ), + migrations.AlterField( + model_name='reseni', + name='forma', + field=models.CharField(choices=[('papir', 'Papírové řešení'), ('email', 'Emailem'), ('upload', 'Upload přes web')], default='email', max_length=16, verbose_name='forma řešení'), + ), + migrations.RenameField( + model_name='reseni', + old_name='problem', + new_name='problem_old', + ), + migrations.AlterField( + model_name='resitel', + name='zasilat', + field=models.CharField(choices=[('domu', 'Domů'), ('do_skoly', 'Do školy'), ('nikam', 'Nikam')], default='domu', max_length=32, verbose_name='kam zasílat'), + ), + migrations.AlterField( + model_name='rocnik', + name='exportovat', + field=models.BooleanField(db_column='exportovat', default=False, help_text='Exportuje se jen podle tohoto flagu (ne veřejnosti), a to jen čísla s veřejnou výsledkovkou', verbose_name='export do AESOPa'), + ), + migrations.AlterField( + model_name='skola', + name='aesop_id', + field=models.CharField(blank=True, default='', help_text='Aesopi ID typu "izo:..." nebo "aesop:..."', max_length=32, verbose_name='Aesop ID'), + ), + migrations.AlterField( + model_name='skola', + name='kratky_nazev', + field=models.CharField(blank=True, help_text='Zkrácený název pro zobrazení ve výsledkovce', max_length=256, verbose_name='zkrácený název'), + ), + migrations.AlterField( + model_name='skola', + name='stat', + field=django_countries.fields.CountryField(default='CZ', help_text='ISO 3166-1 kód země velkými písmeny (CZ, SK, ...)', max_length=2, verbose_name='stát'), + ), + migrations.AlterField( + model_name='soustredeni', + name='exportovat', + field=models.BooleanField(db_column='exportovat', default=False, help_text='Exportuje se jen podle tohoto flagu (ne veřejnosti)', verbose_name='export do AESOPa'), + ), + migrations.AlterField( + model_name='soustredeni', + name='misto', + field=models.CharField(blank=True, default='', help_text='Místo (název obce, volitelně též objektu', max_length=256, verbose_name='místo soustředění'), + ), + migrations.AlterField( + model_name='soustredeni', + name='text', + field=models.TextField(blank=True, default='', verbose_name='text k soustředění (HTML)'), + ), + migrations.AlterField( + model_name='soustredeni', + name='typ', + field=models.CharField(choices=[('jarni', 'Jarní soustředění'), ('podzimni', 'Podzimní soustředění'), ('vikend', 'Víkendový sraz')], default='podzimni', max_length=16, verbose_name='typ akce'), + ), + migrations.AlterField( + model_name='soustredeni', + name='verejne_db', + field=models.BooleanField(db_column='verejne', default=False, verbose_name='soustředění zveřejněno'), + ), + migrations.AlterModelTable( + name='problem', + table='seminar_problemy', + ), + migrations.AddField( + model_name='uloha', + name='cislo_deadline', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='deadlinove_ulohy', to='seminar.Cislo', verbose_name='číslo deadlinu'), + ), + migrations.AddField( + model_name='uloha', + name='cislo_reseni', + field=models.ForeignKey(blank=True, help_text='Číslo s řešením úlohy, jen pro úlohy', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='resene_ulohy', to='seminar.Cislo', verbose_name='číslo řešení'), + ), + migrations.AddField( + model_name='uloha', + name='cislo_zadani', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='zadane_ulohy', to='seminar.Cislo', verbose_name='číslo zadání'), + ), + migrations.AddField( + model_name='tema', + name='rocnik', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='seminar.Rocnik', verbose_name='ročník'), + ), + migrations.AddField( + model_name='reseni_resitele', + name='reseni', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='seminar.Reseni', verbose_name='řešení'), + ), + migrations.AddField( + model_name='reseni_resitele', + name='resitele', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='seminar.Resitel', verbose_name='řešitel'), + ), + migrations.AddField( + model_name='obrazek', + name='text', + field=models.ForeignKey(help_text='text, ve kterém se obrázek vyskytuje', on_delete=django.db.models.deletion.CASCADE, to='seminar.Text', verbose_name='text'), + ), + migrations.AddField( + model_name='hodnoceni', + name='cislo_body', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='hodnoceni', to='seminar.Cislo', verbose_name='číslo pro body'), + ), + migrations.AddField( + model_name='hodnoceni', + name='problem', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='seminar.Problem', verbose_name='problém'), + ), + migrations.AddField( + model_name='hodnoceni', + name='reseni', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='seminar.Reseni', verbose_name='řešení'), + ), + migrations.AddField( + model_name='clanek', + name='cislo', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='seminar.Cislo', verbose_name='číslo'), + ), + migrations.AddField( + model_name='organizator', + name='osoba', + field=models.ForeignKey(help_text='osobní údaje organizátora', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='org', to='seminar.Osoba', verbose_name='osoba'), + ), + migrations.AddField( + model_name='reseni', + name='resitele', + field=models.ManyToManyField(help_text='Seznam autorů řešení', through='seminar.Reseni_Resitele', to='seminar.Resitel', verbose_name='autoři řešení'), + ), + migrations.AddField( + model_name='reseni', + name='text_cely', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='reseni_cely_set', to='seminar.Text', verbose_name='Plná verze textu řešení'), + ), + migrations.AddField( + model_name='reseni', + name='text_zkraceny', + field=models.ManyToManyField(help_text='Seznam úryvků z řešení', related_name='reseni_zkraceny_set', to='seminar.Text', verbose_name='zkrácené verze řešení'), + ), + migrations.AddField( + model_name='resitel', + name='osoba', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='seminar.Osoba', verbose_name='osoba'), + ), + migrations.AddField( + model_name='skola', + name='kontaktni_osoba', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='seminar.Osoba', verbose_name='Kontaktní osoba'), + ), + migrations.AddField( + model_name='reseni', + name='problem', + field=models.ManyToManyField(help_text='Problém', through='seminar.Hodnoceni', to='seminar.Problem', verbose_name='problém'), + ), + ] diff --git a/seminar/migrations/0050_auto_20190510_2228.py b/seminar/migrations/0050_auto_20190510_2228.py new file mode 100644 index 00000000..c6ed9f66 --- /dev/null +++ b/seminar/migrations/0050_auto_20190510_2228.py @@ -0,0 +1,191 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.20 on 2019-05-10 20:28 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0049_auto_20190430_2354'), + ] + + operations = [ + migrations.AlterField( + model_name='konfera', + name='reseni', + field=models.OneToOneField(blank=True, help_text='Účastnický přípěvek o konfeře', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='konfery', to='seminar.Reseni', verbose_name='článek ke konfeře'), + ), + migrations.AlterField( + model_name='organizator', + name='osoba', + field=models.OneToOneField(help_text='osobní údaje organizátora', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='org', to='seminar.Osoba', verbose_name='osoba'), + ), + migrations.AlterField( + model_name='reseni', + name='text_cely', + field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='reseni_cely_set', to='seminar.Text', verbose_name='Plná verze textu řešení'), + ), + migrations.AlterField( + model_name='resitel', + name='osoba', + field=models.OneToOneField(null=True, on_delete=django.db.models.deletion.CASCADE, to='seminar.Osoba', verbose_name='osoba'), + ), + migrations.CreateModel( + name='TreeNode', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ], + options={ + 'verbose_name': 'TreeNode', + 'verbose_name_plural': 'TreeNody', + 'db_table': 'seminar_nodes_treenode', + }, + ), + migrations.CreateModel( + name='CisloNode', + fields=[ + ('treenode_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='seminar.TreeNode')), + ('cislo', models.OneToOneField(on_delete=django.db.models.deletion.PROTECT, to='seminar.Cislo', verbose_name='číslo')), + ], + options={ + 'verbose_name': 'Číslo (Node)', + 'verbose_name_plural': 'Čísla (Node)', + 'db_table': 'seminar_nodes_cislo', + }, + bases=('seminar.treenode',), + ), + migrations.CreateModel( + name='ClanekNode', + fields=[ + ('treenode_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='seminar.TreeNode')), + ('clanek', models.OneToOneField(null=True, on_delete=django.db.models.deletion.PROTECT, to='seminar.Clanek', verbose_name='článek')), + ], + options={ + 'verbose_name': 'Článek (Node)', + 'verbose_name_plural': 'Články (Node)', + 'db_table': 'seminar_nodes_clanek', + }, + bases=('seminar.treenode',), + ), + migrations.CreateModel( + name='KonferaNode', + fields=[ + ('treenode_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='seminar.TreeNode')), + ('konfera', models.OneToOneField(null=True, on_delete=django.db.models.deletion.PROTECT, to='seminar.Konfera', verbose_name='konfera')), + ], + options={ + 'verbose_name': 'Konfera (Node)', + 'verbose_name_plural': 'Konfery (Node)', + 'db_table': 'seminar_nodes_konfera', + }, + bases=('seminar.treenode',), + ), + migrations.CreateModel( + name='MezicisloNode', + fields=[ + ('treenode_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='seminar.TreeNode')), + ], + options={ + 'verbose_name': 'Mezičíslo (Node)', + 'verbose_name_plural': 'Mezičísla (Node)', + 'db_table': 'seminar_nodes_mezicislo', + }, + bases=('seminar.treenode',), + ), + migrations.CreateModel( + name='RocnikNode', + fields=[ + ('treenode_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='seminar.TreeNode')), + ('rocnik', models.OneToOneField(on_delete=django.db.models.deletion.PROTECT, to='seminar.Rocnik', verbose_name='ročník')), + ], + options={ + 'verbose_name': 'Ročník (Node)', + 'verbose_name_plural': 'Ročníky (Node)', + 'db_table': 'seminar_nodes_rocnik', + }, + bases=('seminar.treenode',), + ), + migrations.CreateModel( + name='TemaVCisleNode', + fields=[ + ('treenode_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='seminar.TreeNode')), + ('tema', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Tema', verbose_name='téma v čísle')), + ], + options={ + 'verbose_name': 'Téma v čísle (Node)', + 'verbose_name_plural': 'Témata v čísle (Node)', + 'db_table': 'seminar_nodes_temavcisle', + }, + bases=('seminar.treenode',), + ), + migrations.CreateModel( + name='TextNode', + fields=[ + ('treenode_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='seminar.TreeNode')), + ('text', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Text', verbose_name='text')), + ], + options={ + 'verbose_name': 'Text (Node)', + 'verbose_name_plural': 'Text (Node)', + 'db_table': 'seminar_nodes_obsah', + }, + bases=('seminar.treenode',), + ), + migrations.CreateModel( + name='UlohaVzorakNode', + fields=[ + ('treenode_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='seminar.TreeNode')), + ('uloha', models.OneToOneField(null=True, on_delete=django.db.models.deletion.PROTECT, to='seminar.Uloha', verbose_name='úloha')), + ], + options={ + 'verbose_name': 'Vzorák úlohy (Node)', + 'verbose_name_plural': 'Vzoráky úloh (Node)', + 'db_table': 'seminar_nodes_uloha_vzorak', + }, + bases=('seminar.treenode',), + ), + migrations.CreateModel( + name='UlohaZadaniNode', + fields=[ + ('treenode_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='seminar.TreeNode')), + ('uloha', models.OneToOneField(null=True, on_delete=django.db.models.deletion.PROTECT, to='seminar.Uloha', verbose_name='úloha')), + ], + options={ + 'verbose_name': 'Zadání úlohy (Node)', + 'verbose_name_plural': 'Zadání úloh (Node)', + 'db_table': 'seminar_nodes_uloha_zadani', + }, + bases=('seminar.treenode',), + ), + migrations.CreateModel( + name='PohadkaNode', + fields=[ + ('treenode_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='seminar.TreeNode')), + ('pohadka', models.OneToOneField(on_delete=django.db.models.deletion.PROTECT, to='seminar.Pohadka', verbose_name='pohádka')), + ], + options={ + 'verbose_name': 'Pohádka (Node)', + 'verbose_name_plural': 'Pohádky (Node)', + 'db_table': 'seminar_nodes_pohadka', + }, + bases=('seminar.treenode',), + ), + migrations.AddField( + model_name='treenode', + name='first_child', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='seminar.TreeNode', verbose_name='první potomek'), + ), + migrations.AddField( + model_name='treenode', + name='root', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='potomci_set', to='seminar.TreeNode', verbose_name='kořen stromu'), + ), + migrations.AddField( + model_name='treenode', + name='succ', + field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='prev', to='seminar.TreeNode', verbose_name='další element na stejné úrovni'), + ), + ] diff --git a/seminar/migrations/0051_resitel_to_osoba.py b/seminar/migrations/0051_resitel_to_osoba.py new file mode 100644 index 00000000..17237bd0 --- /dev/null +++ b/seminar/migrations/0051_resitel_to_osoba.py @@ -0,0 +1,89 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.20 on 2019-05-10 20:44 +from __future__ import unicode_literals + +from django.db import migrations + +def resitel_to_osoba(apps,schema_editor): + Resitel = apps.get_model('seminar','Resitel') + Osoba = apps.get_model('seminar','Osoba') + for r in Resitel.objects.all(): + o = Osoba() + o.datum_narozeni = r.datum_narozeni + o.datum_registrace = r.datum_prihlaseni + o.datum_souhlasu_udaje = r.datum_souhlasu_udaje + o.datum_souhlasu_zasilani = r.datum_souhlasu_zasilani + o.email = r.email + o.jmeno = r.jmeno + o.mesto = r.mesto + o.pohlavi_muz = r.pohlavi_muz + o.prijmeni = r.prijmeni + o.psc = r.psc + o.stat = r.stat + o.telefon = r.telefon + o.ulice = r.ulice + o.user = r.user + if o.user: + u = o.user + if u.first_name: + if not o.jmeno: + o.jmeno = u.first_name + u.first_name = 'Použij osobu!' + elif o.jmeno == u.first_name: + u.first_name = 'Použij osobu!' + else: + raise ValueError('jmeno a first_name rozdílné: "{}" vs. "{}"'.format(o.jmeno, u.first_name)) + if u.last_name: + if not o.prijmeni: + o.prijmeni = u.last_name + u.last_name = 'Použij osobu!' + elif o.prijmeni == u.last_name: + u.last_name = 'Použij osobu!' + else: + raise ValueError('prijmeni a last_name rozdílné: "{}" vs. "{}"'.format(o.prijmeni, u.last_name)) + if u.email: + if not o.email: + o.email = u.email + u.email = 'Použij osobu!' + elif o.email == u.email: + u.email = 'Použij osobu!' + else: + raise ValueError('o.email a u.email rozdílné: "{}" vs. "{}"'.format(o.email, u.email)) + u.save() + + + o.save() + r.osoba = o + r.save() + +def osoba_to_resitel(apps, schema_editor): + Resitel = apps.get_model('seminar','Resitel') + Osoba = apps.get_model('seminar','Osoba') + for r in Resitel.objects.all(): + o = r.osoba + r.datum_narozeni = o.datum_narozeni + r.datum_prihlaseni = o.datum_registrace + r.datum_souhlasu_udaje = o.datum_souhlasu_udaje + r.datum_souhlasu_zasilani = o.datum_souhlasu_zasilani + r.email = o.email + r.jmeno = o.jmeno + r.mesto = o.mesto + r.pohlavi_muz = o.pohlavi_muz + r.prijmeni = o.prijmeni + r.psc = o.psc + r.stat = o.stat + r.telefon = o.telefon + r.ulice = o.ulice + r.user = o.user + r.save() + o.delete() + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0050_auto_20190510_2228'), + ] + + operations = [ + migrations.RunPython(resitel_to_osoba, osoba_to_resitel), + ] diff --git a/seminar/migrations/0052_user_to_organizator.py b/seminar/migrations/0052_user_to_organizator.py new file mode 100644 index 00000000..d52e29ca --- /dev/null +++ b/seminar/migrations/0052_user_to_organizator.py @@ -0,0 +1,82 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.15 on 2019-05-16 20:59 +from __future__ import unicode_literals + +from django.db import migrations + +def spoj_k_organizatorum_osoby(apps, scema_editor): + Organizator = apps.get_model('seminar', 'Organizator') + Resitel = apps.get_model('seminar', 'Resitel') + Osoba = apps.get_model('seminar', 'Osoba') + for org in Organizator.objects.all(): + + # Spárování organizátora s osobou + user = org.user + resitele = Resitel.objects.filter(user=user) + if resitele.count() != 0: + osoba = resitele.first().osoba + else: + osoba = Osoba(user=user) + + # Přesun informací z usera do osoby + # pro řešitele již v minule migraci + osoba.jmeno = user.first_name + osoba.prijmeni = user.last_name + osoba.email = user.email + user.jmeno = "Použij osobu!" + user.prijmeni = "Použij osobu!" + user.email = "Použij osobu!" + user.save() + + # Přesun informací z organizátora do jeho osoby + osoba.prezdivka = org.prezdivka if org.prezdivka is not None else '' + osoba.foto = org.foto + + # Všechno uložit + osoba.save() + org.osoba = osoba + org.save() + +def fix_problem(apps, schema_editor): + Problem = apps.get_model('seminar', 'Problem') + Organizator = apps.get_model('seminar', 'Organizator') + for pr in Problem.objects.all(): + if pr.autor_old is not None: + pr.autor = Organizator.objects.filter(osoba__user=pr.autor_old).first() + else: + pr.autor = None + if pr.opravovatel is not None: + pr.opravovatele.add(Organizator.objects.filter(osoba__user=pr.opravovatel).first()) + pr.save() + +def fix_pohadka(apps, schema_editor): + Pohadka = apps.get_model('seminar', 'Pohadka') + Organizator = apps.get_model('seminar', 'Organizator') + for poh in Pohadka.objects.all(): + if poh.autor_old is not None: + poh.autor = Organizator.objects.filter(osoba__user=poh.autor_old).first() + else: + poh.autor = None + poh.save() + +def fix_novinka(apps, schema_editor): + Novinky = apps.get_model('seminar', 'Novinky') + Organizator = apps.get_model('seminar', 'Organizator') + for nov in Novinky.objects.all(): + nov.autor = Organizator.objects.filter(osoba__user=nov.autor_old).first() + nov.save() + + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0051_resitel_to_osoba'), + ] + + operations = [ + migrations.RunPython(spoj_k_organizatorum_osoby), + migrations.RunPython(fix_problem), + migrations.RunPython(fix_pohadka), + migrations.RunPython(fix_novinka), + ] diff --git a/seminar/migrations/0053_organizator_organizuje_od_do.py b/seminar/migrations/0053_organizator_organizuje_od_do.py new file mode 100644 index 00000000..b94e8032 --- /dev/null +++ b/seminar/migrations/0053_organizator_organizuje_od_do.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.20 on 2019-05-16 21:26 +from __future__ import unicode_literals + +import datetime as dt +from django.db import migrations + +def rok_to_datetime(apps,schema_editor): + Organizator = apps.get_model('seminar','Organizator') + for o in Organizator.objects.all(): + rok = o.organizuje_od_roku + if rok: + o.organizuje_od = dt.datetime(rok,1,1) + rok = o.organizuje_do_roku + if rok: + o.organizuje_do = dt.datetime(rok,12,31) + o.save() + +def datetime_to_rok(apps,schema_editor): + Organizator = apps.get_model('seminar','Organizator') + for o in Organizator.objects.all(): + o.organizuje_od_roku = o.organizuje_od.year + o.organizuje_do_roku = o.organizuje_do.year + o.save() + + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0052_user_to_organizator'), + ] + + operations = [ + migrations.RunPython(rok_to_datetime, datetime_to_rok), + ] diff --git a/seminar/migrations/0055_smazat_nemigrovane_zastarale_veci.py b/seminar/migrations/0055_smazat_nemigrovane_zastarale_veci.py new file mode 100644 index 00000000..1b6f95f4 --- /dev/null +++ b/seminar/migrations/0055_smazat_nemigrovane_zastarale_veci.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.20 on 2019-05-23 20:16 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0053_organizator_organizuje_od_do'), + ] + + operations = [ + migrations.RemoveField( + model_name='prispevek', + name='problem', + ), + migrations.RemoveField( + model_name='prispevek', + name='reseni', + ), + migrations.DeleteModel( + name='ProblemNavrh', + ), + migrations.DeleteModel( + name='ProblemZadany', + ), + migrations.RemoveField( + model_name='cislo', + name='faze', + ), + migrations.RemoveField( + model_name='konfera', + name='popis', + ), + migrations.RemoveField( + model_name='konfera', + name='prispevek', + ), + migrations.RemoveField( + model_name='problem', + name='import_dakos_id', + ), + migrations.RemoveField( + model_name='resitel', + name='import_mamoper_id', + ), + migrations.RemoveField( + model_name='skola', + name='import_dakos_id', + ), + migrations.DeleteModel( + name='Prispevek', + ), + ] diff --git a/seminar/migrations/0056_vrcholy_pro_rocniky_a_cisla.py b/seminar/migrations/0056_vrcholy_pro_rocniky_a_cisla.py new file mode 100644 index 00000000..024400a4 --- /dev/null +++ b/seminar/migrations/0056_vrcholy_pro_rocniky_a_cisla.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.20 on 2019-05-23 21:54 +from __future__ import unicode_literals + +from django.db import migrations + +def generuj_RocnikNody_a_CisloNody(apps,schema_editor): + Rocnik = apps.get_model('seminar', 'Rocnik') + RocnikNode = apps.get_model('seminar', 'RocnikNode') + Cislo = apps.get_model('seminar', 'Cislo') + CisloNode = apps.get_model('seminar', 'CisloNode') + + last_rn = None # last_* slouží k navázání následníků + for r in Rocnik.objects.all(): + rn = RocnikNode.objects.create(rocnik=r) + rn.save() + rn.root = rn + rn.save() + if last_rn: + last_rn.succ = rn + last_rn.save() + last_rn = rn + + last_cn = None + for c in Cislo.objects.filter(rocnik=r): + cn = CisloNode.objects.create(cislo=c, root=rn) + cn.save() + if last_cn: # Jsme něčí následník + last_cn.succ = cn + last_cn.save() + else: # Jsme první v řadě, takže se musíme přidat jako first_child RočníkNodu + rn.first_child = cn + rn.save() + last_cn = cn + + + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0055_smazat_nemigrovane_zastarale_veci'), + ] + + operations = [ + migrations.RunPython(generuj_RocnikNody_a_CisloNody), + ] diff --git a/seminar/migrations/0057_reseni_to_reseni_hodnoceni.py b/seminar/migrations/0057_reseni_to_reseni_hodnoceni.py new file mode 100644 index 00000000..b3f0405b --- /dev/null +++ b/seminar/migrations/0057_reseni_to_reseni_hodnoceni.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.20 on 2019-05-28 21:46 +from __future__ import unicode_literals + +from django.db import migrations + +def reseni_to_Reseni(apps, schema_editor): + Reseni = apps.get_model('seminar','Reseni') + Reseni_Resitele = apps.get_model('seminar','Reseni_Resitele') + Hodnoceni = apps.get_model('seminar','Hodnoceni') + + for r in Reseni.objects.all(): + rr = Reseni_Resitele.objects.create(resitele = r.resitel, reseni=r) + if r.body == None: + print("!!!!!!!!!!!!!!!") + print(r.id,r) + print("!!!!!!!!!!!!!!!") + else: + h = Hodnoceni.objects.create( + body=r.body, + cislo_body = r.cislo_body, + problem = r.problem_old, + reseni = r) + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0056_vrcholy_pro_rocniky_a_cisla'), + ] + + operations = [ + migrations.RunPython(reseni_to_Reseni) + ] diff --git a/seminar/migrations/0058_problem_to_uloha_tema_clanek.py b/seminar/migrations/0058_problem_to_uloha_tema_clanek.py new file mode 100644 index 00000000..333f5453 --- /dev/null +++ b/seminar/migrations/0058_problem_to_uloha_tema_clanek.py @@ -0,0 +1,161 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.20 on 2019-05-17 17:44 +from __future__ import unicode_literals + +from django.db import migrations + +from django.db.models import Q + +def poskladej_strom(apps, rodic, *texty): + Text = apps.get_model('seminar', 'Text') + TextNode = apps.get_model('seminar', 'TextNode') + if not rodic: + raise ValueError("Rodič musí být definovaný") + + uz_ma_deti = False + tn = None + for txt in texty: + if not txt: + continue + # Přidej do stromu: + textobj = Text.objects.create(na_web = txt) + textobj.save() + textnode = TextNode.objects.create(text = textobj) + textnode.save() + if not uz_ma_deti: + rodic.first_child = textnode + rodic.save() + tn = rodic.first_child + uz_ma_deti = True + else: + tn.succ = textnode + tn.save() + tn = tn.succ + +def uloha_to_Uloha(apps,schema_editor): + Problem = apps.get_model('seminar', 'Problem') + Uloha = apps.get_model('seminar', 'Uloha') + Text = apps.get_model('seminar', 'Text') + UlohaZadaniNode = apps.get_model('seminar', 'UlohaZadaniNode') + UlohaVzorakNode = apps.get_model('seminar', 'UlohaVzorakNode') + TextNode = apps.get_model('seminar', 'TextNode') + + ulohy = Problem.objects.filter(typ = 'uloha') + for uold in ulohy: + unew = Uloha.objects.create( + problem_ptr = uold, + # Zakomentované fieldy by se už měly nacházet v příslušném problému + #nazev = uold.nazev, + #stav = uold.stav, + #zamereni = uold.zamereni, + #poznamka = uold.poznamka, + #autor = uold.autor, + #kod = uold.kod, + cislo_zadani = uold.cislo_zadani_old, + cislo_reseni = uold.cislo_reseni_old, + max_body = uold.body, + #vytvoreno = uold.vytvoreno, + ) +# unew.opravovatele.add(*uold.opravovatele.all()) + unew.save() + + # Nody: + zadani_node = UlohaZadaniNode.objects.create(uloha = unew) + poskladej_strom(apps, zadani_node, uold.text_zadani) + zadani_node.save() + vzorak_node = UlohaVzorakNode.objects.create(uloha = unew) + poskladej_strom(apps, vzorak_node, uold.text_reseni) + vzorak_node.save() + +def konfery_rucne(apps, schema_editor): + # Tohle dělat nebudu, máme aktuálně celou jednu. Ale "Errors should never pass silently" + Problem = apps.get_model('seminar', 'Problem') + pocet_konfer = Problem.objects.filter(typ = 'konfera').count() + if pocet_konfer > 0: + raise NotImplementedError("Zkonvertuj {} konfer na objekt Konfera ručně, prosím".format(pocet_konfer)) + +def clanek_to_Clanek(apps,schema_editor): + Problem = apps.get_model('seminar', 'Problem') + Clanek = apps.get_model('seminar', 'Clanek') + ClanekNode = apps.get_model('seminar', 'ClanekNode') + Text = apps.get_model('seminar', 'Text') + TextNode = apps.get_model('seminar', 'TextNode') + + clanky = Problem.objects.filter(Q(typ='org-clanek') | Q(typ='res-clanek')) + for cl in clanky: + # Vybereme vhodné číslo pro článek z čísla zadání a čísla řešení: + if cl.cislo_zadani_old is None: + cislo = cl.cislo_reseni_old + elif cl.cislo_reseni_old is None: + cislo = cl.cislo_zadani_old + elif cl.cislo_reseni_old == cl.cislo_zadani_old: + cislo = cl.cislo_zadani_old + else: + raise ValueError("Různá čísla zadání a řešení u článku! (Článek: {})".format(cl.nazev)) + + clnew = Clanek.objects.create( + problem_ptr = cl, + # Problém by nemělo být potřeba upravovat + cislo = cislo, + # Body ignorujeme, protože už jsou v hodnocení + ) + clnew.save() + + # Aktuálně nemáme v modelu informaci o tom, jestli je to org-článek + # nebo řešitelský článek. Aby se neztratila informace, poznamenám to do + # poznámky. + cl.poznamka += "\nTyp:\t{}".format(cl.typ) + cl.save() + + # Vyrobíme nody: + clnode = ClanekNode(clanek = clnew) + poskladej_strom(apps, clnode, cl.text_zadani, cl.text_reseni) + clnode.save() + +def tema_to_Tema(apps, schema_editor): + Problem = apps.get_model('seminar', 'Problem') + Tema = apps.get_model('seminar', 'Tema') + TemaVCisleNode = apps.get_model('seminar', 'TemaVCisleNode') + Text = apps.get_model('seminar', 'Text') + TextNode = apps.get_model('seminar', 'TextNode') + + temata = Problem.objects.filter(Q(typ = 'tema') | Q(typ='serial')) + for t in temata: + # Vymyslíme správně ročník: + if t.cislo_zadani_old is None and t.cislo_reseni_old is None: + rocnik = None + elif t.cislo_zadani_old is None: + rocnik = t.cislo_reseni_old.rocnik + elif t.cislo_reseni_old is None: + rocnik = t.cislo_zadani_old.rocnik + elif t.cislo_reseni_old.rocnik == t.cislo_zadani_old.rocnik: + rocnik = t.cislo_zadani_old.rocnik + else: + raise ValueError("Nelze mít téma přes více ročníků! (Téma: {}".format(t.nazev)) + + tnew = Tema.objects.create( + problem_ptr = t, + tema_typ = t.typ, + rocnik = rocnik, + ) + tnew.save() + + # Nody: + tnode = TemaVCisleNode(tema = tnew) + poskladej_strom(apps, tnode, t.text_zadani, t.text_reseni) + tnode.save() + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0057_reseni_to_reseni_hodnoceni'), + ] + + operations = [ + # ashes to Ashes, dust to Dust.... + migrations.RunPython(uloha_to_Uloha), + migrations.RunPython(tema_to_Tema), + migrations.RunPython(clanek_to_Clanek), + migrations.RunPython(konfery_rucne), + ] diff --git a/seminar/migrations/0059_vytvorit_pohadkanode.py b/seminar/migrations/0059_vytvorit_pohadkanode.py new file mode 100644 index 00000000..7ff7c655 --- /dev/null +++ b/seminar/migrations/0059_vytvorit_pohadkanode.py @@ -0,0 +1,29 @@ +# -*- 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 vytvor_pohadkanode(apps, schema_editor): + Pohadka = apps.get_model('seminar', 'Pohadka') + PohadkaNode = apps.get_model('seminar', 'PohadkaNode') + Text = apps.get_model('seminar', 'Text') + TextNode = apps.get_model('seminar', 'TextNode') + + for p in Pohadka.objects.all(): + t = Text.objects.create(na_web = p.text) + t.save() + tn = TextNode.objects.create(text = t) + tn.save() + pn = PohadkaNode.objects.create(pohadka = p, first_child = tn) + pn.save() + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0058_problem_to_uloha_tema_clanek'), + ] + + operations = [ + migrations.RunPython(vytvor_pohadkanode), + ] diff --git a/seminar/migrations/0060_spoj_stromy.py b/seminar/migrations/0060_spoj_stromy.py new file mode 100644 index 00000000..a94caf48 --- /dev/null +++ b/seminar/migrations/0060_spoj_stromy.py @@ -0,0 +1,112 @@ +# -*- 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 + +from django.db.models import Q + +def pridej_potomka(rodic, potomek): + # Daný vrchol bude posledním potomkem rodiče + uz_ma_deti = False + posledni = None + + # Přidávaný potomek by neměl mít následovníka -- přidáváme potomka, ne podles. + if potomek.succ: + raise ValueError("Potomek má následovníka, to je velmi podezřelé!") + + # 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! + Cislo = apps.get_model('seminar', 'Cislo') + 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') + Pohadka = apps.get_model('seminar', 'Pohadka') + + for c in Cislo.objects.all().reverse(): + cnode = c.cislonode + + # Témata a seriály: + relevantni_temata = Tema.objects.filter(Q(cislo_zadani_old = c) | Q(cislo_reseni_old = c)).order_by('kod') + # Téma dáme do prvního čísla, kde se vyskytne + for t in relevantni_temata: + tnode = t.temavcislenode + if t.cislo_zadani_old and t.cislo_reseni_old: + assert(t.cislo_zadani_old <= t.cislo_reseni_old) + if t.cislo_reseni_old == c: + # Už by mělo být přidané do čísla zadání + continue + else: + # Patří sem (buď je to jediné číslo, nebo je to číslo zadání) + pridej_potomka(cnode, tnode) + + # Úložky (zadání) a pohádky + for u in Uloha.objects.filter(cislo_zadani = c).order_by('kod'): + unode = u.ulohazadaninode + pohadky_pred = Pohadka.objects.filter(uloha_old = u.problem_ptr, pred = True) + pohadky_po = Pohadka.objects.filter(uloha_old = u.problem_ptr, pred = False) + for p in pohadky_pred: + pnode = p.pohadkanode + pridej_potomka(cnode, pnode) + pridej_potomka(cnode, unode) + for p in pohadky_po: + pnode = p.pohadkanode + pridej_potomka(cnode, pnode) + + # Pohádky, které nejsou u úlohy jsou špatně: + if Pohadka.objects.exclude(uloha_old__typ='uloha').count(): + raise ValueError("Existuje pohádka, která není u úlohy") + + # Články + for cl in Clanek.objects.filter(cislo = c).order_by('kod'): + clnode = cl.claneknode + pridej_potomka(cnode, clnode) + + # Konfery + for k in Konfera.objects.all(): + knode = k.konferanode + if k.reseni and knode.root is None: + # Takováhle konfera nejspíš neexistuje + raise NotImplementedError("Konfery neumím zapojit do stromu") + + # Vzoráky + for u in Uloha.objects.filter(cislo_reseni = c).order_by('kod'): + unode = u.ulohavzoraknode + pridej_potomka(cnode, unode) + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0059_vytvorit_pohadkanode'), + ] + + operations = [ + migrations.RunPython(pokacej_les), + ] diff --git a/seminar/migrations/0061_kill_frankenstein.py b/seminar/migrations/0061_kill_frankenstein.py new file mode 100644 index 00000000..0a367edf --- /dev/null +++ b/seminar/migrations/0061_kill_frankenstein.py @@ -0,0 +1,153 @@ +# -*- 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', '0060_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', + ), + ] diff --git a/seminar/migrations/0062_redukce_modelu_pohadky.py b/seminar/migrations/0062_redukce_modelu_pohadky.py new file mode 100644 index 00000000..b4e5f11e --- /dev/null +++ b/seminar/migrations/0062_redukce_modelu_pohadky.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.20 on 2019-05-30 01:16 +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', '0061_kill_frankenstein'), + ] + + operations = [ + migrations.AlterModelOptions( + name='pohadka', + options={'ordering': ['vytvoreno'], 'verbose_name': 'Pohádka', 'verbose_name_plural': 'Pohádky'}, + ), + migrations.RemoveField( + model_name='pohadka', + name='pred', + ), + migrations.RemoveField( + model_name='pohadka', + name='text', + ), + migrations.RemoveField( + model_name='pohadka', + name='uloha', + ), + ] diff --git a/seminar/migrations/0063_procisteni_migraci.py b/seminar/migrations/0063_procisteni_migraci.py new file mode 100644 index 00000000..3dce57ad --- /dev/null +++ b/seminar/migrations/0063_procisteni_migraci.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.20 on 2019-05-30 01:32 +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', '0062_redukce_modelu_pohadky'), + ] + + operations = [ + migrations.AlterField( + model_name='cislo', + name='verejna_vysledkovka', + # Změnil se help_text -- byly v něm tabulátory kvůli zlomu v modelech + field=models.BooleanField(default=False, help_text='Je-li false u veřejného čísla, není výsledkovka zatím veřejná.', verbose_name='zveřejněna výsledkovka'), + ), + migrations.AlterField( + model_name='prijemce', + name='osoba', + # Bylo: ForeignKey + 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', + # Bylo: editable=False + field=models.DateTimeField(blank=True, default=django.utils.timezone.now, verbose_name='čas_doručení'), + ), + ] diff --git a/seminar/migrations/0064_auto_20190610_2358.py b/seminar/migrations/0064_auto_20190610_2358.py new file mode 100644 index 00000000..344b132c --- /dev/null +++ b/seminar/migrations/0064_auto_20190610_2358.py @@ -0,0 +1,162 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.21 on 2019-06-10 21:58 +from __future__ import unicode_literals + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0063_procisteni_migraci'), + ] + + operations = [ + migrations.AlterField( + model_name='cislo', + name='rocnik', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='cisla', to='seminar.Rocnik', verbose_name='ročník'), + ), + migrations.AlterField( + model_name='clanek', + name='cislo', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='seminar.Cislo', verbose_name='číslo'), + ), + migrations.AlterField( + model_name='hodnoceni', + name='cislo_body', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='hodnoceni', to='seminar.Cislo', verbose_name='číslo pro body'), + ), + migrations.AlterField( + model_name='hodnoceni', + name='problem', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Problem', verbose_name='problém'), + ), + migrations.AlterField( + model_name='konfery_ucastnici', + name='konfera', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='seminar.Konfera', verbose_name='konfera'), + ), + migrations.AlterField( + model_name='konfery_ucastnici', + name='resitel', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Resitel', verbose_name='řešitel'), + ), + migrations.AlterField( + model_name='nastaveni', + name='aktualni_cislo', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Cislo', verbose_name='poslední vydané číslo'), + ), + migrations.AlterField( + model_name='nastaveni', + name='aktualni_rocnik', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Rocnik', verbose_name='aktuální ročník'), + ), + migrations.AlterField( + model_name='novinky', + name='autor', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='seminar.Organizator', verbose_name='Autor novinky'), + ), + migrations.AlterField( + model_name='organizator', + name='osoba', + field=models.OneToOneField(help_text='osobní údaje organizátora', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='org', to='seminar.Osoba', verbose_name='osoba'), + ), + migrations.AlterField( + model_name='osoba', + name='user', + field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, to=settings.AUTH_USER_MODEL, verbose_name='uživatel'), + ), + migrations.AlterField( + model_name='pohadka', + name='autor', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='seminar.Organizator', verbose_name='Autor pohádky'), + ), + migrations.AlterField( + model_name='problem', + name='autor', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='autor_problemu_problem', to='seminar.Organizator', verbose_name='autor problému'), + ), + migrations.AlterField( + model_name='problem', + name='garant', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='garant_problemu_problem', to='seminar.Organizator', verbose_name='garant zadaného problému'), + ), + migrations.AlterField( + model_name='problem', + name='nadproblem', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='nadproblem_problem', to='seminar.Problem', verbose_name='nadřazený problém'), + ), + migrations.AlterField( + model_name='reseni', + name='text_cely', + field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='reseni_cely_set', to='seminar.Text', verbose_name='Plná verze textu řešení'), + ), + migrations.AlterField( + model_name='reseni_resitele', + name='resitele', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Resitel', verbose_name='řešitel'), + ), + migrations.AlterField( + model_name='resitel', + name='osoba', + field=models.OneToOneField(null=True, on_delete=django.db.models.deletion.SET_NULL, to='seminar.Osoba', verbose_name='osoba'), + ), + migrations.AlterField( + model_name='resitel', + name='skola', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='seminar.Skola', verbose_name='škola'), + ), + migrations.AlterField( + model_name='skola', + name='kontaktni_osoba', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='seminar.Osoba', verbose_name='Kontaktní osoba'), + ), + migrations.AlterField( + model_name='soustredeni', + name='rocnik', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='soustredeni', to='seminar.Rocnik', verbose_name='ročník'), + ), + migrations.AlterField( + model_name='soustredeni_organizatori', + name='organizator', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Organizator', verbose_name='organizátor'), + ), + migrations.AlterField( + model_name='soustredeni_organizatori', + name='soustredeni', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Soustredeni', verbose_name='soustředění'), + ), + migrations.AlterField( + model_name='soustredeni_ucastnici', + name='resitel', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Resitel', verbose_name='řešitel'), + ), + migrations.AlterField( + model_name='soustredeni_ucastnici', + name='soustredeni', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Soustredeni', verbose_name='soustředění'), + ), + migrations.AlterField( + model_name='tema', + name='rocnik', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='seminar.Rocnik', verbose_name='ročník'), + ), + migrations.AlterField( + model_name='uloha', + name='cislo_deadline', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='deadlinove_ulohy', to='seminar.Cislo', verbose_name='číslo deadlinu'), + ), + migrations.AlterField( + model_name='uloha', + name='cislo_reseni', + field=models.ForeignKey(blank=True, help_text='Číslo s řešením úlohy, jen pro úlohy', null=True, on_delete=django.db.models.deletion.PROTECT, related_name='resene_ulohy', to='seminar.Cislo', verbose_name='číslo řešení'), + ), + migrations.AlterField( + model_name='uloha', + name='cislo_zadani', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='zadane_ulohy', to='seminar.Cislo', verbose_name='číslo zadání'), + ), + ] diff --git a/seminar/migrations/0065_treenode_polymorphic_ctype.py b/seminar/migrations/0065_treenode_polymorphic_ctype.py new file mode 100644 index 00000000..71eef262 --- /dev/null +++ b/seminar/migrations/0065_treenode_polymorphic_ctype.py @@ -0,0 +1,31 @@ +# Generated by Django 2.2.4 on 2019-08-13 19:36 + +from django.db import migrations, models +import django.db.models.deletion + +def vyrob_treenodum_ctypes(apps, schema_editor): + # Kód zkopírovaný z dokumentace: https://django-polymorphic.readthedocs.io/en/stable/migrating.html + # XXX: Nevím, jestli se tohle náhodou nemělo spustit na všech childech (jen/i) + TreeNode = apps.get_model('seminar', 'TreeNode') + ContentType = apps.get_model('contenttypes', 'ContentType') + + new_ct = ContentType.objects.get_for_model(TreeNode) + TreeNode.objects.filter(polymorphic_ctype__isnull=True).update(polymorphic_ctype=new_ct) + + + +class Migration(migrations.Migration): + + dependencies = [ + ('contenttypes', '0002_remove_content_type_name'), + ('seminar', '0064_auto_20190610_2358'), + ] + + operations = [ + migrations.AddField( + model_name='treenode', + name='polymorphic_ctype', + field=models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='polymorphic_seminar.treenode_set+', to='contenttypes.ContentType'), + ), + migrations.RunPython(vyrob_treenodum_ctypes, migrations.RunPython.noop), + ] diff --git a/seminar/migrations/0066_problem_polymorphic_ctype.py b/seminar/migrations/0066_problem_polymorphic_ctype.py new file mode 100644 index 00000000..f956217e --- /dev/null +++ b/seminar/migrations/0066_problem_polymorphic_ctype.py @@ -0,0 +1,29 @@ +# Generated by Django 2.2.4 on 2019-08-13 19:45 + +from django.db import migrations, models +import django.db.models.deletion + +def vyrob_problemum_ctypes(apps, schema_editor): + # Kód zkopírovaný z dokumentace: https://django-polymorphic.readthedocs.io/en/stable/migrating.html + # XXX: Nevím, jestli se tohle náhodou nemělo spustit na všech childech (jen/i) + Problem = apps.get_model('seminar', 'Problem') + ContentType = apps.get_model('contenttypes', 'ContentType') + + new_ct = ContentType.objects.get_for_model(Problem) + Problem.objects.filter(polymorphic_ctype__isnull=True).update(polymorphic_ctype=new_ct) + +class Migration(migrations.Migration): + + dependencies = [ + ('contenttypes', '0002_remove_content_type_name'), + ('seminar', '0065_treenode_polymorphic_ctype'), + ] + + operations = [ + migrations.AddField( + model_name='problem', + name='polymorphic_ctype', + field=models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='polymorphic_seminar.problem_set+', to='contenttypes.ContentType'), + ), + migrations.RunPython(vyrob_problemum_ctypes, migrations.RunPython.noop), + ] diff --git a/seminar/migrations/0067_auto_20190814_0805.py b/seminar/migrations/0067_auto_20190814_0805.py new file mode 100644 index 00000000..8a72a659 --- /dev/null +++ b/seminar/migrations/0067_auto_20190814_0805.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.4 on 2019-08-14 06:05 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0066_problem_polymorphic_ctype'), + ] + + operations = [ + migrations.AlterField( + model_name='konfera', + name='nazev', + field=models.CharField(help_text='Název konfery', max_length=100, verbose_name='název konfery'), + ), + ]