From a1731ef157a786bd77724443923e7000dd4bddfa Mon Sep 17 00:00:00 2001 From: "Tomas \"Jethro\" Pokorny" Date: Mon, 10 Jun 2019 23:55:45 +0200 Subject: [PATCH 1/9] Opravy pro Django 2.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Zatím jen část. --- galerie/models.py | 8 ++-- korektury/models.py | 13 +++--- mamweb/settings_common.py | 2 +- mamweb/settings_local.py | 2 +- prednasky/models.py | 9 ++-- seminar/admin.py | 2 +- seminar/export.py | 2 +- seminar/models.py | 92 ++++++++++++++++++++++++--------------- seminar/views.py | 2 +- 9 files changed, 78 insertions(+), 54 deletions(-) diff --git a/galerie/models.py b/galerie/models.py index 4a90b131..9a582ccd 100644 --- a/galerie/models.py +++ b/galerie/models.py @@ -57,7 +57,7 @@ class Obrazek(models.Model): nazev = models.CharField('Název', max_length=50, blank=True, null=True) popis = models.TextField('Popis', blank=True, null=True) datum_vlozeni = models.DateTimeField('Datum vložení', auto_now_add=True) - galerie = models.ForeignKey('Galerie', blank=True, null=True) + galerie = models.ForeignKey('Galerie', blank=True, null=True, on_delete=models.SET_NULL) poradi = models.IntegerField('Pořadí', blank=True, null=True) def __unicode__(self): @@ -88,8 +88,10 @@ class Galerie(models.Model): popis = models.TextField('Popis', blank = True, null = True) titulni_obrazek = models.ForeignKey(Obrazek, blank = True, null = True, related_name = "+", on_delete = models.SET_NULL) zobrazit = models.IntegerField('Zobrazit?', default = ORG, choices = VIDITELNOST) - galerie_up = models.ForeignKey('Galerie', blank = True, null = True) - soustredeni = models.ForeignKey(Soustredeni, blank = True, null = True) + galerie_up = models.ForeignKey('Galerie', blank = True, null = True, + on_delete=models.SET_NULL) + soustredeni = models.ForeignKey(Soustredeni, blank = True, null = True, + on_delete=models.PROTECT) poradi = models.IntegerField('Pořadí', blank = True, null = True) def __unicode__(self): diff --git a/korektury/models.py b/korektury/models.py index 553fa797..534677ed 100644 --- a/korektury/models.py +++ b/korektury/models.py @@ -49,9 +49,8 @@ class KorekturovanePDF(models.Model): pdf = models.FileField(u'PDF', upload_to = generate_filename) org = models.ForeignKey(Organizator, blank=True, - help_text='Zodpovědný organizátor za obsah', - null=True, - default=None) + help_text='Zodpovědný organizátor za obsah', + null=True, default=None, on_delete=models.SET_NULL) stran = models.IntegerField(u'počet stran', help_text='Počet stran PDF', default=0) @@ -124,7 +123,7 @@ class Oprava(models.Model): #Interní ID id = models.AutoField(primary_key = True) - pdf = models.ForeignKey(KorekturovanePDF, default=-1) + pdf = models.ForeignKey(KorekturovanePDF, default=-1, on_delete=models.PROTECT) strana = models.IntegerField(u'strana s opravou', help_text='Strana s opravou (od 0)') @@ -146,7 +145,7 @@ class Oprava(models.Model): autor = models.ForeignKey(Organizator, blank = True, help_text='Autor opravy', - null = True) + null = True, on_delete=models.SET_NULL) text = models.TextField(u'text opravy',blank = True, help_text='Text opravy') @@ -173,10 +172,10 @@ class Komentar(models.Model): cas = models.DateTimeField(u'čas komentáře',default=timezone.now,help_text = 'Čas zadání komentáře') - oprava = models.ForeignKey(Oprava) + oprava = models.ForeignKey(Oprava, on_delete=models.CASCADE) autor = models.ForeignKey(Organizator, blank = True, help_text = u'Autor komentáře', - null = True) + null = True, on_delete=models.SET_NULL) text = models.TextField(u'text komentáře',blank = True, help_text='Text komentáře') diff --git a/mamweb/settings_common.py b/mamweb/settings_common.py index 6d171ca0..87d01f37 100644 --- a/mamweb/settings_common.py +++ b/mamweb/settings_common.py @@ -52,7 +52,7 @@ AUTHENTICATION_BACKENDS = ( ) -MIDDLEWARE_CLASSES = ( +MIDDLEWARE = ( 'reversion.middleware.RevisionMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', diff --git a/mamweb/settings_local.py b/mamweb/settings_local.py index 885e2b9e..6941c9aa 100644 --- a/mamweb/settings_local.py +++ b/mamweb/settings_local.py @@ -10,7 +10,7 @@ import os.path # Import common settings from .settings_common import * -MIDDLEWARE_CLASSES += ( +MIDDLEWARE += ( 'debug_toolbar.middleware.DebugToolbarMiddleware', ) diff --git a/prednasky/models.py b/prednasky/models.py index 1cda462f..fe56a269 100644 --- a/prednasky/models.py +++ b/prednasky/models.py @@ -25,7 +25,8 @@ class Seznam(models.Model): ordering = ['soustredeni', 'stav'] id = models.AutoField(primary_key = True) - soustredeni = models.ForeignKey(Soustredeni,null = True, default = None) + soustredeni = models.ForeignKey(Soustredeni,null = True, default = None, + on_delete=models.PROTECT) stav = models.IntegerField('Stav',choices=STAV_CHOICES,default = STAV_NAVRH) def __str__(self): @@ -55,7 +56,7 @@ class Prednaska(models.Model): id = models.AutoField(primary_key = True) nazev = models.CharField('Název', max_length = 300) - org = models.ForeignKey(Organizator) + org = models.ForeignKey(Organizator, on_delete=models.PROTECT) popis = models.TextField('Popis pro orgy',null = True, blank = True,help_text = 'Neveřejný popis pro ostatní orgy') anotace = models.TextField('Anotace',null = True, blank = True, help_text = 'Veřejná anotace v hlasování') obtiznost = models.IntegerField('Obtížnost', choices=CHOICES_OBTIZNOST) @@ -75,10 +76,10 @@ class Hlasovani(models.Model): verbose_name_plural = 'Hlasování' ordering = ['ucastnik', 'prednaska'] id = models.AutoField(primary_key = True) - prednaska = models.ForeignKey(Prednaska) + prednaska = models.ForeignKey(Prednaska, on_delete=models.CASCADE) body = models.IntegerField('Body', default = 0, choices = CHOICES_BODY) ucastnik = models.CharField('Účastník', max_length = 100) - seznam = models.ForeignKey(Seznam) + seznam = models.ForeignKey(Seznam,null=True,on_delete=models.SET_NULL) def __str__(self): return force_unicode("{} dal {} bodů {} v seznamu {}".format(self.ucastnik, diff --git a/seminar/admin.py b/seminar/admin.py index 59eab849..01fd98ff 100644 --- a/seminar/admin.py +++ b/seminar/admin.py @@ -9,7 +9,7 @@ from ckeditor_uploader.widgets import CKEditorUploadingWidget from django.db.models import Count from django.db import models from django.utils.safestring import mark_safe -from django.core.urlresolvers import reverse +from django.urls import reverse from django.contrib.auth.models import User diff --git a/seminar/export.py b/seminar/export.py index 9b09d11f..0143101e 100644 --- a/seminar/export.py +++ b/seminar/export.py @@ -1,7 +1,7 @@ import datetime, django from django.shortcuts import get_object_or_404, render from django.http import HttpResponse -from django.core.urlresolvers import reverse +from django.urls import reverse from django.views import generic from django.utils.encoding import force_text diff --git a/seminar/models.py b/seminar/models.py index d94d1e3d..e7eff91e 100644 --- a/seminar/models.py +++ b/seminar/models.py @@ -9,7 +9,7 @@ from django.conf import settings from django.utils.encoding import python_2_unicode_compatible from django.utils.encoding import force_text from django.utils.text import slugify -from django.core.urlresolvers import reverse +from django.urls import reverse from django.core.cache import cache from django.core.exceptions import ObjectDoesNotExist from django.utils.text import get_valid_filename @@ -64,7 +64,7 @@ class Osoba(SeminarModelBase): # User, pokud má na webu účet user = models.OneToOneField(settings.AUTH_USER_MODEL, blank=True, null=True, - verbose_name='uživatel') + verbose_name='uživatel', on_delete=models.DO_NOTHING) # Pohlaví. Že ho neznáme se snad nestane (a ušetří to práci při programování) pohlavi_muz = models.BooleanField('pohlaví (muž)', default=False) @@ -180,7 +180,7 @@ class Skola(SeminarModelBase): help_text='Neveřejná poznámka ke škole (plain text)') kontaktni_osoba = models.ForeignKey(Osoba, verbose_name='Kontaktní osoba', - blank=True, null=True) + blank=True, null=True, on_delete=models.SET_NULL) def __str__(self): return '{}, {}, {}'.format(self.nazev, self.ulice, self.mesto) @@ -199,7 +199,8 @@ class Prijemce(SeminarModelBase): help_text='Neveřejná poznámka k příemci čísel (plain text)') osoba = models.OneToOneField(Osoba, verbose_name='komu', blank=False, null=False, - help_text='Které osobě či na jakou adresu se mají zasílat čísla') + help_text='Které osobě či na jakou adresu se mají zasílat čísla', + on_delete=models.CASCADE) # FIXME: možná chceme něco jako vazbu na osobu XOR školu a počet kusů k zaslání # FIXME: a možná taky posílání na mail a možná taky přes něj chceme posílat i řešitelům @@ -220,9 +221,12 @@ class Resitel(SeminarModelBase): # Interní ID id = models.AutoField(primary_key = True) - osoba = models.OneToOneField(Osoba, blank=False, null=True, verbose_name='osoba') # FIXME opravit po prvni migraci + osoba = models.OneToOneField(Osoba, blank=False, null=True, verbose_name='osoba', + on_delete=models.SET_NULL) # FIXME opravit po prvni migraci + - skola = models.ForeignKey(Skola, blank=True, null=True, verbose_name='škola') + skola = models.ForeignKey(Skola, blank=True, null=True, verbose_name='škola', + on_delete=models.SET_NULL) # Očekávaný rok maturity a vyřazení z aktivních řešitelů rok_maturity = models.IntegerField('rok maturity', blank=True, null=True) @@ -378,7 +382,8 @@ class Cislo(SeminarModelBase): # Interní ID id = models.AutoField(primary_key = True) - rocnik = models.ForeignKey(Rocnik, verbose_name='ročník', related_name='cisla', db_index=True) + rocnik = models.ForeignKey(Rocnik, verbose_name='ročník', related_name='cisla', + db_index=True,on_delete=models.PROTECT) cislo = models.CharField('název čísla', max_length=32, db_index=True, help_text='Většinou jen "1", vyjímečně "7-8", lexikograficky určuje pořadí v ročníku!') @@ -456,7 +461,8 @@ class Organizator(SeminarModelBase): # zmena dedicnosti z models.Model na SeminarModelBase, potencialni vznik bugu osoba = models.OneToOneField(Osoba, verbose_name='osoba', related_name='org', - help_text='osobní údaje organizátora', null=True, blank=False) #FIXME opravit po migraci + help_text='osobní údaje organizátora', null=True, blank=False, + on_delete=models.SET_NULL) #FIXME opravit po migraci vytvoreno = models.DateTimeField( 'Vytvořeno', @@ -506,7 +512,8 @@ class Soustredeni(SeminarModelBase): # Interní ID id = models.AutoField(primary_key = True) - rocnik = models.ForeignKey(Rocnik, verbose_name='ročník', related_name='soustredeni') + rocnik = models.ForeignKey(Rocnik, verbose_name='ročník', related_name='soustredeni', + on_delete=models.PROTECT) datum_zacatku = models.DateField('datum začátku', blank=True, null=True, help_text='První den soustředění') @@ -575,7 +582,8 @@ class Problem(SeminarModelBase): # Problém má podproblémy nadproblem = models.ForeignKey('self', verbose_name='nadřazený problém', - related_name='nadproblem_%(class)s', null=True, blank=True) + related_name='nadproblem_%(class)s', null=True, blank=True, + on_delete=models.SET_NULL) STAV_NAVRH = 'navrh' STAV_ZADANY = 'zadany' @@ -596,10 +604,12 @@ class Problem(SeminarModelBase): help_text='Neveřejný návrh úlohy, návrh řešení, text zadání, poznámky ...') autor = models.ForeignKey(Organizator, verbose_name='autor problému', - related_name='autor_problemu_%(class)s', null=True, blank=True) + related_name='autor_problemu_%(class)s', null=True, blank=True, + on_delete=models.SET_NULL) garant = models.ForeignKey(Organizator, verbose_name='garant zadaného problému', - related_name='garant_problemu_%(class)s', null=True, blank=True) + related_name='garant_problemu_%(class)s', null=True, blank=True, + on_delete=models.SET_NULL) opravovatele = models.ManyToManyField(Organizator, verbose_name='opravovatelé', blank=True, related_name='opravovatele_%(class)s') @@ -662,7 +672,8 @@ class Tema(Problem): tema_typ = models.CharField('Typ tématu', max_length=16, choices=TEMA_CHOICES, blank=False, default=TEMA_TEMA) - rocnik = models.ForeignKey(Rocnik, verbose_name='ročník',blank=True, null=True) + rocnik = models.ForeignKey(Rocnik, verbose_name='ročník',blank=True, null=True, + on_delete=models.PROTECT) def kod_v_rocniku(self): if self.stav == 'zadany': @@ -677,7 +688,8 @@ class Clanek(Problem): verbose_name = 'Článek' verbose_name_plural = 'Články' - cislo = models.ForeignKey(Cislo, verbose_name='číslo', blank=True, null=True) + cislo = models.ForeignKey(Cislo, verbose_name='číslo', blank=True, null=True, + on_delete=models.PROTECT) def kod_v_rocniku(self): if self.stav == 'zadany': # Nemělo by být potřeba @@ -708,14 +720,15 @@ class Uloha(Problem): verbose_name_plural = 'Úlohy' cislo_zadani = models.ForeignKey(Cislo, verbose_name='číslo zadání', blank=True, - null=True, related_name='zadane_ulohy') + null=True, related_name='zadane_ulohy', on_delete=models.PROTECT) cislo_deadline = models.ForeignKey(Cislo, verbose_name='číslo deadlinu', blank=True, - null=True, related_name='deadlinove_ulohy') + null=True, related_name='deadlinove_ulohy', on_delete=models.PROTECT) cislo_reseni = models.ForeignKey(Cislo, verbose_name='číslo řešení', blank=True, null=True, related_name='resene_ulohy', - help_text='Číslo s řešením úlohy, jen pro úlohy') + help_text='Číslo s řešením úlohy, jen pro úlohy', + on_delete=models.PROTECT) max_body = models.DecimalField(max_digits=8, decimal_places=1, verbose_name='maximum bodů', blank=True, null=True) @@ -765,7 +778,8 @@ class Reseni(SeminarModelBase): default=FORMA_EMAIL) text_cely = models.OneToOneField(Text, verbose_name='Plná verze textu řešení', - blank=True, null=True, related_name="reseni_cely_set") + blank=True, null=True, related_name="reseni_cely_set", + on_delete=models.SET_NULL) text_zkraceny = models.ManyToManyField(Text, verbose_name='zkrácené verze řešení', help_text='Seznam úryvků z řešení',related_name="reseni_zkraceny_set") @@ -801,11 +815,11 @@ class Hodnoceni(SeminarModelBase): blank=False, null=False) cislo_body = models.ForeignKey(Cislo, verbose_name='číslo pro body', - related_name='hodnoceni', blank=False, null=False) + related_name='hodnoceni', blank=False, null=False, on_delete=models.PROTECT) - reseni = models.ForeignKey(Reseni, verbose_name='řešení') + reseni = models.ForeignKey(Reseni, verbose_name='řešení', on_delete=models.CASCADE) - problem = models.ForeignKey(Problem, verbose_name='problém') + problem = models.ForeignKey(Problem, verbose_name='problém', on_delete=models.PROTECT) def __str__(self): return "{}, {}, {}".format(self.problem, self.reseni, self.body) @@ -856,7 +870,8 @@ class PrilohaReseni(SeminarModelBase): # Interní ID id = models.AutoField(primary_key = True) - reseni = models.ForeignKey(Reseni, verbose_name='řešení', related_name='prilohy') + reseni = models.ForeignKey(Reseni, verbose_name='řešení', related_name='prilohy', + on_delete=models.CASCADE) vytvoreno = models.DateTimeField('vytvořeno', default=timezone.now, blank=True, editable=False) @@ -887,7 +902,8 @@ class Pohadka(SeminarModelBase): # Při nahrávání z TeXu není vyplnění vyžadováno, v adminu je null=True, - blank=False + blank=False, + on_delete=models.SET_NULL ) vytvoreno = models.DateTimeField( @@ -915,9 +931,10 @@ class Soustredeni_Ucastnici(SeminarModelBase): # Interní ID id = models.AutoField(primary_key = True) - resitel = models.ForeignKey(Resitel, verbose_name='řešitel') + resitel = models.ForeignKey(Resitel, verbose_name='řešitel', on_delete=models.PROTECT) - soustredeni = models.ForeignKey(Soustredeni, verbose_name='soustředění') + soustredeni = models.ForeignKey(Soustredeni, verbose_name='soustředění', + on_delete=models.PROTECT) poznamka = models.TextField('neveřejná poznámka', blank=True, help_text='Neveřejná poznámka k účasti (plain text)') @@ -939,9 +956,11 @@ class Soustredeni_Organizatori(SeminarModelBase): # Interní ID id = models.AutoField(primary_key = True) - organizator = models.ForeignKey(Organizator, verbose_name='organizátor') + organizator = models.ForeignKey(Organizator, verbose_name='organizátor', + on_delete=models.PROTECT) - soustredeni = models.ForeignKey(Soustredeni, verbose_name='soustředění') + soustredeni = models.ForeignKey(Soustredeni, verbose_name='soustředění', + on_delete=models.PROTECT) poznamka = models.TextField('neveřejná poznámka', blank=True, help_text='Neveřejná poznámka k účasti organizátora (plain text)') @@ -1018,9 +1037,9 @@ class Reseni_Resitele(models.Model): # Interní ID id = models.AutoField(primary_key = True) - resitele = models.ForeignKey(Resitel, verbose_name='řešitel') + resitele = models.ForeignKey(Resitel, verbose_name='řešitel', on_delete=models.PROTECT) - reseni = models.ForeignKey(Reseni, verbose_name='řešení') + reseni = models.ForeignKey(Reseni, verbose_name='řešení', on_delete=models.CASCADE) # podil - jakou merou se ktery resitel podilel na danem reseni # - pouziti v budoucnu, pokud by resitele nemeli dostat vsichni stejne bodu za spolecne reseni @@ -1041,9 +1060,9 @@ class Konfery_Ucastnici(models.Model): # Interní ID id = models.AutoField(primary_key = True) - resitel = models.ForeignKey(Resitel, verbose_name='řešitel') + resitel = models.ForeignKey(Resitel, verbose_name='řešitel', on_delete=models.PROTECT) - konfera = models.ForeignKey(Konfera, verbose_name='konfera') + konfera = models.ForeignKey(Konfera, verbose_name='konfera', on_delete=models.CASCADE) poznamka = models.TextField('neveřejná poznámka', blank=True, help_text='Neveřejná poznámka k účasti (plain text)') @@ -1065,7 +1084,8 @@ class Obrazek(SeminarModelBase): null=True, blank=True) text = models.ForeignKey(Text, verbose_name='text', - help_text='text, ve kterém se obrázek vyskytuje', null=False, blank=False) + help_text='text, ve kterém se obrázek vyskytuje', + null=False, blank=False, on_delete=models.CASCADE) do_cisla_barevny = models.FileField('barevný obrázek do čísla', help_text = 'Barevná verze obrázku do čísla', @@ -1284,10 +1304,11 @@ class Nastaveni(SingletonModel): db_table = 'seminar_nastaveni' verbose_name = 'Nastavení semináře' - aktualni_rocnik = models.ForeignKey(Rocnik, verbose_name='aktuální ročník', null=False) + aktualni_rocnik = models.ForeignKey(Rocnik, verbose_name='aktuální ročník', + null=False, on_delete=models.PROTECT) aktualni_cislo = models.ForeignKey(Cislo, verbose_name='poslední vydané číslo', - null=False) + null=False, on_delete=models.PROTECT) def __str__(self): return 'Nastavení semináře' @@ -1321,7 +1342,8 @@ class Novinky(models.Model): ], options={'quality': 95}) - autor = models.ForeignKey(Organizator, verbose_name='Autor novinky', null=True) + autor = models.ForeignKey(Organizator, verbose_name='Autor novinky', null=True, + on_delete=models.SET_NULL) zverejneno = models.BooleanField('Zveřejněno', default=False) diff --git a/seminar/views.py b/seminar/views.py index 3f01376f..7a67cf82 100644 --- a/seminar/views.py +++ b/seminar/views.py @@ -2,7 +2,7 @@ from django.shortcuts import get_object_or_404, render from django.http import HttpResponse, HttpResponseRedirect, HttpResponseForbidden, JsonResponse -from django.core.urlresolvers import reverse +from django.urls import reverse from django.core.exceptions import PermissionDenied, ObjectDoesNotExist from django.views import generic from django.utils.translation import ugettext as _ From c79cf3fe4da3dd535ccfa134a4cc7d370943ce42 Mon Sep 17 00:00:00 2001 From: "Martin Z. (Zimamazim)" Date: Tue, 11 Jun 2019 00:25:22 +0200 Subject: [PATCH 2/9] Upravil jsem funkci gen_soustredeni. --- seminar/testutils.py | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/seminar/testutils.py b/seminar/testutils.py index edd836fa..6c80e80d 100644 --- a/seminar/testutils.py +++ b/seminar/testutils.py @@ -59,6 +59,7 @@ def gen_osoby(rnd, size): datum_registrace = datetime.date(rnd.randint(2019, 2029), rnd.randint(1, 12), rnd.randint(1, 28)))) #TODO pridat foto male a velke. Jak? + # Pavel tvrdí, že to necháme a přidáme až do adminu return osoby @@ -206,18 +207,21 @@ def gen_ulohy_do_cisla(rnd, cislo, organizatori, resitele, slovnik_cisel, size): return def gen_soustredeni(): - # TODO: vice soustredeni a k nim nahodne podmnoziny organizatoru a ucastniku - # TODO: pozor, organizatori a ucastnici jsou ManyToManyField, musí se přiřadit - # mimo create() a pak dát save() - sous = Soustredeni.objects.create(rocnik=Rocnik.objects.first(), - verejne_db=True, - misto=u'Někde', - datum_zacatku=datetime.date(2000, 11, 23), - datum_konce=datetime.date(2000, 11, 27) - ) - for res in rnd.sample(resitele, min(len(resitele), 20)): - Soustredeni_Ucastnici.objects.create(resitel=res, soustredeni=sous) - sous.save() + sousy = [] + for sousi in range(1, size): #FIXME Tu range si změňte jak chcete, nevím, co přesně znamená size (asi Anet?) + datum_zacatku=datetime.date(randint(2000, 2020), randint(1, 12), radint(1, 28)) + working_sous = Soustredeni.objects.create(rocnik=Rocnik.objects.order_by('?').first(), + verejne_db=rnd.choice([True, False]), + misto=rnd.choice(['Kremrolovice', 'Indiánov', 'U zmzliny', 'Vafláreň', 'Větrník', 'Horní Rakvička', 'Dolní cheesecake']), + datum_zacatku=datum_zacatku, + datum_konce=datum_zacatku + datetime.timedelta(weeks=1)) + for res in rnd.sample(resitele, min(len(resitele), 20)): + Soustredeni_Ucastnici.objects.create(resitel=res, soutredeni=working_sous) + for org in rnd.sample(organizatori, min(len(organizatori), 20)): + Soustredeni_Organizatori.objects.create(organizator=org, soutredeni=working_sous) + working_sous.save() + sousy.append(working_sous) + return sousy @transaction.atomic From 5849cf07a04edf3b62ea80e4f0302c30fe4e6826 Mon Sep 17 00:00:00 2001 From: "Tomas \"Jethro\" Pokorny" Date: Tue, 11 Jun 2019 00:46:39 +0200 Subject: [PATCH 3/9] Opravene migrace A taky nejake nove, snad jsem nic nerozbil... --- galerie/migrations/0001_initial.py | 6 +- .../0004_nepovinna_galerie_u_obrazku.py | 2 +- galerie/migrations/0008_auto_20190430_2340.py | 71 ++++++++ galerie/migrations/0009_auto_20190610_2358.py | 31 ++++ korektury/migrations/0001_initial.py | 2 +- .../migrations/0002_auto_20151202_2351.py | 2 +- korektury/migrations/0006_oprava_pdf.py | 2 +- .../0010_Pridani_odkazu_na_organizatora.py | 4 +- korektury/migrations/0014_add_org_to_pdf.py | 10 +- .../migrations/0015_auto_20161004_2005.py | 2 +- .../migrations/0016_auto_20190430_2340.py | 77 +++++++++ .../migrations/0017_auto_20190610_2358.py | 36 ++++ prednasky/migrations/0001_initial.py | 4 +- .../migrations/0002_auto_20160417_2347.py | 2 +- .../migrations/0003_auto_20160929_0117.py | 2 +- .../migrations/0005_auto_20160929_0153.py | 6 +- prednasky/migrations/0006_hlasovani_seznam.py | 2 +- .../migrations/0011_auto_20190430_2340.py | 40 +++++ .../migrations/0012_auto_20190610_2358.py | 31 ++++ seminar/migrations/0001_initial.py | 28 +-- .../migrations/0005_alter_problem_autor.py | 2 +- ...013_soustredeni_ucastnici_through_model.py | 4 +- seminar/migrations/0023_add_novinky.py | 2 +- seminar/migrations/0024_add_organizator.py | 2 +- .../migrations/0036_add_org_to_soustredeni.py | 4 +- seminar/migrations/0037_prispevek.py | 4 +- seminar/migrations/0039_pohadka.py | 4 +- .../0040_pohadka_nepovinny_autor.py | 2 +- seminar/migrations/0041_konfery.py | 5 +- seminar/migrations/0064_auto_20190610_2358.py | 162 ++++++++++++++++++ 30 files changed, 500 insertions(+), 51 deletions(-) create mode 100644 galerie/migrations/0008_auto_20190430_2340.py create mode 100644 galerie/migrations/0009_auto_20190610_2358.py create mode 100644 korektury/migrations/0016_auto_20190430_2340.py create mode 100644 korektury/migrations/0017_auto_20190610_2358.py create mode 100644 prednasky/migrations/0011_auto_20190430_2340.py create mode 100644 prednasky/migrations/0012_auto_20190610_2358.py create mode 100644 seminar/migrations/0064_auto_20190610_2358.py diff --git a/galerie/migrations/0001_initial.py b/galerie/migrations/0001_initial.py index b7406da6..21701185 100644 --- a/galerie/migrations/0001_initial.py +++ b/galerie/migrations/0001_initial.py @@ -21,8 +21,8 @@ class Migration(migrations.Migration): ('datum_zmeny', models.DateTimeField(auto_now=True, verbose_name=b'Datum posledn\xc3\xad zm\xc4\x9bny')), ('popis', models.TextField(null=True, verbose_name=b'Popis', blank=True)), ('zobrazit', models.IntegerField(default=1, verbose_name=b'Zobrazit?', choices=[(0, b'V\xc5\xbedy'), (1, b'Organiz\xc3\xa1tor\xc5\xafm'), (2, b'Nikdy')])), - ('galerie_up', models.ForeignKey(blank=True, to='galerie.Galerie', null=True)), - ('soustredeni', models.ForeignKey(blank=True, to='seminar.Soustredeni', null=True)), + ('galerie_up', models.ForeignKey(blank=True, to='galerie.Galerie', null=True, on_delete=models.CASCADE)), + ('soustredeni', models.ForeignKey(blank=True, to='seminar.Soustredeni', null=True, on_delete=models.CASCADE)), ], options={ 'verbose_name': 'Galerie', @@ -42,7 +42,7 @@ class Migration(migrations.Migration): ('datum_vlozeni', models.DateTimeField(auto_now_add=True, verbose_name=b'Datum vlo\xc5\xbeen\xc3\xad')), ('datum', models.DateTimeField(verbose_name=b'Datum po\xc5\x99\xc3\xadzen\xc3\xad fotografie')), ('poradi', models.IntegerField(null=True, verbose_name=b'Po\xc5\x99ad\xc3\xad', blank=True)), - ('galerie', models.ForeignKey(to='galerie.Galerie')), + ('galerie', models.ForeignKey(to='galerie.Galerie', on_delete=models.CASCADE)), ], options={ 'verbose_name': 'Obr\xe1zek', diff --git a/galerie/migrations/0004_nepovinna_galerie_u_obrazku.py b/galerie/migrations/0004_nepovinna_galerie_u_obrazku.py index c522adfe..53e17922 100644 --- a/galerie/migrations/0004_nepovinna_galerie_u_obrazku.py +++ b/galerie/migrations/0004_nepovinna_galerie_u_obrazku.py @@ -14,7 +14,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='obrazek', name='galerie', - field=models.ForeignKey(blank=True, to='galerie.Galerie', null=True), + field=models.ForeignKey(blank=True, to='galerie.Galerie', null=True, on_delete=models.CASCADE), preserve_default=True, ), ] diff --git a/galerie/migrations/0008_auto_20190430_2340.py b/galerie/migrations/0008_auto_20190430_2340.py new file mode 100644 index 00000000..140d554a --- /dev/null +++ b/galerie/migrations/0008_auto_20190430_2340.py @@ -0,0 +1,71 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.20 on 2019-04-30 21:40 +from __future__ import unicode_literals + +from django.db import migrations, models +import galerie.models + + +class Migration(migrations.Migration): + + dependencies = [ + ('galerie', '0007_obrazek_odstranen_datum'), + ] + + operations = [ + migrations.AlterField( + model_name='galerie', + name='datum_vytvoreni', + field=models.DateTimeField(auto_now_add=True, verbose_name='Datum vytvoření'), + ), + migrations.AlterField( + model_name='galerie', + name='datum_zmeny', + field=models.DateTimeField(auto_now=True, verbose_name='Datum poslední změny'), + ), + migrations.AlterField( + model_name='galerie', + name='nazev', + field=models.CharField(max_length=100, verbose_name='Název'), + ), + migrations.AlterField( + model_name='galerie', + name='popis', + field=models.TextField(blank=True, null=True, verbose_name='Popis'), + ), + migrations.AlterField( + model_name='galerie', + name='poradi', + field=models.IntegerField(blank=True, null=True, verbose_name='Pořadí'), + ), + migrations.AlterField( + model_name='galerie', + name='zobrazit', + field=models.IntegerField(choices=[(0, 'Vždy'), (1, 'Organizátorům'), (2, 'Nikdy')], default=1, verbose_name='Zobrazit?'), + ), + migrations.AlterField( + model_name='obrazek', + name='datum_vlozeni', + field=models.DateTimeField(auto_now_add=True, verbose_name='Datum vložení'), + ), + migrations.AlterField( + model_name='obrazek', + name='nazev', + field=models.CharField(blank=True, max_length=50, null=True, verbose_name='Název'), + ), + migrations.AlterField( + model_name='obrazek', + name='obrazek_velky', + field=models.ImageField(help_text='Lze vložit libovolně velký obrázek. Ideální je, aby alespoň jeden rozměr měl alespoň 500px.', upload_to=galerie.models.obrazek_filename), + ), + migrations.AlterField( + model_name='obrazek', + name='popis', + field=models.TextField(blank=True, null=True, verbose_name='Popis'), + ), + migrations.AlterField( + model_name='obrazek', + name='poradi', + field=models.IntegerField(blank=True, null=True, verbose_name='Pořadí'), + ), + ] diff --git a/galerie/migrations/0009_auto_20190610_2358.py b/galerie/migrations/0009_auto_20190610_2358.py new file mode 100644 index 00000000..0228a8a7 --- /dev/null +++ b/galerie/migrations/0009_auto_20190610_2358.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.21 on 2019-06-10 21:58 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('galerie', '0008_auto_20190430_2340'), + ] + + operations = [ + migrations.AlterField( + model_name='galerie', + name='galerie_up', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='galerie.Galerie'), + ), + migrations.AlterField( + model_name='galerie', + name='soustredeni', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='seminar.Soustredeni'), + ), + migrations.AlterField( + model_name='obrazek', + name='galerie', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='galerie.Galerie'), + ), + ] diff --git a/korektury/migrations/0001_initial.py b/korektury/migrations/0001_initial.py index 22643689..e9a89d18 100644 --- a/korektury/migrations/0001_initial.py +++ b/korektury/migrations/0001_initial.py @@ -50,7 +50,7 @@ class Migration(migrations.Migration): ('cas', models.DateTimeField(help_text=b'\xc4\x8cas zad\xc3\xa1n\xc3\xad koment\xc3\xa1\xc5\x99e', verbose_name='\u010das koment\xe1\u0159e')), ('autor', models.TextField(help_text=b'Autor koment\xc3\xa1\xc5\x99e', verbose_name='autor koment\xe1\u0159e', blank=True)), ('text', models.TextField(help_text=b'Text koment\xc3\xa1\xc5\x99e', verbose_name='text koment\xe1\u0159e', blank=True)), - ('oprava', models.ForeignKey(to='korektury.Oprava')), + ('oprava', models.ForeignKey(to='korektury.Oprava', on_delete=models.CASCADE)), ], options={ 'ordering': ['cas'], diff --git a/korektury/migrations/0002_auto_20151202_2351.py b/korektury/migrations/0002_auto_20151202_2351.py index ba88f7c7..2e7a8032 100644 --- a/korektury/migrations/0002_auto_20151202_2351.py +++ b/korektury/migrations/0002_auto_20151202_2351.py @@ -19,7 +19,7 @@ class Migration(migrations.Migration): ('cas', models.DateTimeField(default=django.utils.timezone.now, help_text=b'\xc4\x8cas zad\xc3\xa1n\xc3\xad koment\xc3\xa1\xc5\x99e', verbose_name='\u010das koment\xe1\u0159e')), ('autor', models.TextField(help_text=b'Autor koment\xc3\xa1\xc5\x99e', verbose_name='autor koment\xe1\u0159e', blank=True)), ('text', models.TextField(help_text=b'Text koment\xc3\xa1\xc5\x99e', verbose_name='text koment\xe1\u0159e', blank=True)), - ('oprava', models.ForeignKey(to='korektury.Oprava')), + ('oprava', models.ForeignKey(to='korektury.Oprava', on_delete=models.CASCADE)), ], options={ 'ordering': ['cas'], diff --git a/korektury/migrations/0006_oprava_pdf.py b/korektury/migrations/0006_oprava_pdf.py index 2adf04e7..e8f81884 100644 --- a/korektury/migrations/0006_oprava_pdf.py +++ b/korektury/migrations/0006_oprava_pdf.py @@ -14,7 +14,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='oprava', name='pdf', - field=models.ForeignKey(default=-1, to='korektury.KorekturovanePDF'), + field=models.ForeignKey(default=-1, to='korektury.KorekturovanePDF', on_delete=models.CASCADE), preserve_default=True, ), ] diff --git a/korektury/migrations/0010_Pridani_odkazu_na_organizatora.py b/korektury/migrations/0010_Pridani_odkazu_na_organizatora.py index e76d5058..6b318cab 100644 --- a/korektury/migrations/0010_Pridani_odkazu_na_organizatora.py +++ b/korektury/migrations/0010_Pridani_odkazu_na_organizatora.py @@ -15,11 +15,11 @@ class Migration(migrations.Migration): migrations.AddField( model_name='komentar', name='autor_org', - field=models.ForeignKey(blank=True, to='seminar.Organizator', help_text='Autor koment\xe1\u0159e', null=True), + field=models.ForeignKey(blank=True, to='seminar.Organizator', help_text='Autor koment\xe1\u0159e', null=True, on_delete=models.CASCADE), ), migrations.AddField( model_name='oprava', name='autor_org', - field=models.ForeignKey(blank=True, to='seminar.Organizator', help_text=b'Autor opravy', null=True), + field=models.ForeignKey(blank=True, to='seminar.Organizator', help_text=b'Autor opravy', null=True, on_delete=models.CASCADE), ), ] diff --git a/korektury/migrations/0014_add_org_to_pdf.py b/korektury/migrations/0014_add_org_to_pdf.py index 9c1292e4..afd939ba 100644 --- a/korektury/migrations/0014_add_org_to_pdf.py +++ b/korektury/migrations/0014_add_org_to_pdf.py @@ -16,10 +16,10 @@ class Migration(migrations.Migration): model_name='korekturovanepdf', name='org', field=models.ForeignKey(default=None, - blank=True, - to='seminar.Organizator', - help_text=b'Zodpov\xc4\x9bdn\xc3\xbd\ - organiz\xc3\xa1tor za obsah', - null=True), + blank=True, + to='seminar.Organizator', + help_text=b'Zodpov\xc4\x9bdn\xc3\xbd\ + organiz\xc3\xa1tor za obsah', + null=True, on_delete=models.CASCADE), ), ] diff --git a/korektury/migrations/0015_auto_20161004_2005.py b/korektury/migrations/0015_auto_20161004_2005.py index c087a221..36be10df 100644 --- a/korektury/migrations/0015_auto_20161004_2005.py +++ b/korektury/migrations/0015_auto_20161004_2005.py @@ -14,6 +14,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='korekturovanepdf', name='org', - field=models.ForeignKey(default=None, blank=True, to='seminar.Organizator', help_text=b'Zodpov\xc4\x9bdn\xc3\xbd organiz\xc3\xa1tor za obsah', null=True), + field=models.ForeignKey(default=None, blank=True, to='seminar.Organizator', help_text=b'Zodpov\xc4\x9bdn\xc3\xbd organiz\xc3\xa1tor za obsah', null=True, on_delete=models.CASCADE), ), ] diff --git a/korektury/migrations/0016_auto_20190430_2340.py b/korektury/migrations/0016_auto_20190430_2340.py new file mode 100644 index 00000000..f14bce2b --- /dev/null +++ b/korektury/migrations/0016_auto_20190430_2340.py @@ -0,0 +1,77 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.20 on 2019-04-30 21:40 +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 = [ + ('korektury', '0015_auto_20161004_2005'), + ] + + operations = [ + migrations.AlterField( + model_name='komentar', + name='cas', + field=models.DateTimeField(default=django.utils.timezone.now, help_text='Čas zadání komentáře', verbose_name='čas komentáře'), + ), + migrations.AlterField( + model_name='komentar', + name='text', + field=models.TextField(blank=True, help_text='Text komentáře', verbose_name='text komentáře'), + ), + migrations.AlterField( + model_name='korekturovanepdf', + name='cas', + field=models.DateTimeField(default=django.utils.timezone.now, help_text='Čas vložení PDF', verbose_name='čas vložení PDF'), + ), + migrations.AlterField( + model_name='korekturovanepdf', + name='komentar', + field=models.TextField(blank=True, help_text='Komentář ke korekturovanému PDF (např. na co se zaměřit)', verbose_name='komentář k PDF'), + ), + migrations.AlterField( + model_name='korekturovanepdf', + name='nazev', + field=models.CharField(blank=True, help_text='Název (např. 22.1 verze 4) korekturovaného PDF', max_length=50, verbose_name='název PDF'), + ), + migrations.AlterField( + model_name='korekturovanepdf', + name='org', + field=models.ForeignKey(blank=True, default=None, help_text='Zodpovědný organizátor za obsah', null=True, on_delete=django.db.models.deletion.CASCADE, to='seminar.Organizator'), + ), + migrations.AlterField( + model_name='korekturovanepdf', + name='status', + field=models.CharField(choices=[('pridavani', 'Přidávání korektur'), ('zanaseni', 'Korektury jsou zanášeny'), ('zastarale', 'Stará verze, nekorigovat')], default='pridavani', max_length=16, verbose_name='stav PDF'), + ), + migrations.AlterField( + model_name='korekturovanepdf', + name='stran', + field=models.IntegerField(default=0, help_text='Počet stran PDF', verbose_name='počet stran'), + ), + migrations.AlterField( + model_name='oprava', + name='autor', + field=models.ForeignKey(blank=True, help_text='Autor opravy', null=True, on_delete=django.db.models.deletion.CASCADE, to='seminar.Organizator'), + ), + migrations.AlterField( + model_name='oprava', + name='status', + field=models.CharField(choices=[('k_oprave', 'K opravě'), ('opraveno', 'Opraveno'), ('neni_chyba', 'Není chyba'), ('k_zaneseni', 'K zanesení do TeXu')], default='k_oprave', max_length=16, verbose_name='stav opravy'), + ), + migrations.AlterField( + model_name='oprava', + name='strana', + field=models.IntegerField(help_text='Strana s opravou (od 0)', verbose_name='strana s opravou'), + ), + migrations.AlterField( + model_name='oprava', + name='text', + field=models.TextField(blank=True, help_text='Text opravy', verbose_name='text opravy'), + ), + ] diff --git a/korektury/migrations/0017_auto_20190610_2358.py b/korektury/migrations/0017_auto_20190610_2358.py new file mode 100644 index 00000000..111f2f8f --- /dev/null +++ b/korektury/migrations/0017_auto_20190610_2358.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.21 on 2019-06-10 21:58 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('korektury', '0016_auto_20190430_2340'), + ] + + operations = [ + migrations.AlterField( + model_name='komentar', + name='autor', + field=models.ForeignKey(blank=True, help_text='Autor komentáře', null=True, on_delete=django.db.models.deletion.SET_NULL, to='seminar.Organizator'), + ), + migrations.AlterField( + model_name='korekturovanepdf', + name='org', + field=models.ForeignKey(blank=True, default=None, help_text='Zodpovědný organizátor za obsah', null=True, on_delete=django.db.models.deletion.SET_NULL, to='seminar.Organizator'), + ), + migrations.AlterField( + model_name='oprava', + name='autor', + field=models.ForeignKey(blank=True, help_text='Autor opravy', null=True, on_delete=django.db.models.deletion.SET_NULL, to='seminar.Organizator'), + ), + migrations.AlterField( + model_name='oprava', + name='pdf', + field=models.ForeignKey(default=-1, on_delete=django.db.models.deletion.PROTECT, to='korektury.KorekturovanePDF'), + ), + ] diff --git a/prednasky/migrations/0001_initial.py b/prednasky/migrations/0001_initial.py index c3510548..07da4a4e 100644 --- a/prednasky/migrations/0001_initial.py +++ b/prednasky/migrations/0001_initial.py @@ -28,7 +28,7 @@ class Migration(migrations.Migration): ('obtiznost', models.IntegerField(verbose_name=b'Obt\xc3\xad\xc5\xbenost', choices=[(1, b'Lehk\xc3\xa1'), (2, b'St\xc5\x99edn\xc3\xad'), (3, b'T\xc4\x9b\xc5\xbek\xc3\xa1')])), ('obor', models.CharField(max_length=5, verbose_name=b'Obor')), ('klicova', models.CharField(max_length=200, null=True, verbose_name=b'Kl\xc3\xad\xc4\x8dov\xc3\xa1 slova', blank=True)), - ('org', models.ForeignKey(to='seminar.Organizator')), + ('org', models.ForeignKey(to='seminar.Organizator', on_delete=models.CASCADE)), ], ), migrations.CreateModel( @@ -40,6 +40,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name='hlasovani', name='prednaska', - field=models.ForeignKey(to='prednasky.Prednaska'), + field=models.ForeignKey(to='prednasky.Prednaska', on_delete=models.CASCADE), ), ] diff --git a/prednasky/migrations/0002_auto_20160417_2347.py b/prednasky/migrations/0002_auto_20160417_2347.py index f3527e75..aa09d465 100644 --- a/prednasky/migrations/0002_auto_20160417_2347.py +++ b/prednasky/migrations/0002_auto_20160417_2347.py @@ -14,7 +14,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='prednaska', name='seznam', - field=models.ForeignKey(default=None, blank=True, to='prednasky.Seznam'), + field=models.ForeignKey(default=None, blank=True, to='prednasky.Seznam', on_delete=models.CASCADE), ), migrations.AlterField( model_name='hlasovani', diff --git a/prednasky/migrations/0003_auto_20160929_0117.py b/prednasky/migrations/0003_auto_20160929_0117.py index 9e2cfb17..98a31ea4 100644 --- a/prednasky/migrations/0003_auto_20160929_0117.py +++ b/prednasky/migrations/0003_auto_20160929_0117.py @@ -51,7 +51,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='prednaska', name='seznam', - field=models.ForeignKey(to='prednasky.Seznam_old'), + field=models.ForeignKey(to='prednasky.Seznam_old',on_delete=models.CASCADE), ), migrations.AlterModelTable( name='hlasovani', diff --git a/prednasky/migrations/0005_auto_20160929_0153.py b/prednasky/migrations/0005_auto_20160929_0153.py index 8aacd6fd..7ecff0a0 100644 --- a/prednasky/migrations/0005_auto_20160929_0153.py +++ b/prednasky/migrations/0005_auto_20160929_0153.py @@ -16,7 +16,7 @@ class Migration(migrations.Migration): name='Prednaska_Seznam', fields=[ ('id', models.AutoField(serialize=False, primary_key=True)), - ('prednaska', models.ForeignKey(to='prednasky.Prednaska')), + ('prednaska', models.ForeignKey(to='prednasky.Prednaska', on_delete=models.CASCADE)), ], options={ 'db_table': 'prednasky_prednaska_seznam', @@ -29,7 +29,7 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(serialize=False, primary_key=True)), ('stav', models.IntegerField(default=2, verbose_name=b'Stav', choices=[(1, b'N\xc3\xa1vrh'), (2, b'Bude')])), - ('soustredeni', models.ForeignKey(default=None, to='seminar.Soustredeni', null=True)), + ('soustredeni', models.ForeignKey(default=None, to='seminar.Soustredeni', null=True, on_delete=models.CASCADE)), ], options={ 'ordering': ['soustredeni', 'stav'], @@ -44,6 +44,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name='prednaska_seznam', name='seznam', - field=models.ForeignKey(to='prednasky.Seznam'), + field=models.ForeignKey(to='prednasky.Seznam', on_delete=models.CASCADE), ), ] diff --git a/prednasky/migrations/0006_hlasovani_seznam.py b/prednasky/migrations/0006_hlasovani_seznam.py index c6c1e609..e1b7bd8f 100644 --- a/prednasky/migrations/0006_hlasovani_seznam.py +++ b/prednasky/migrations/0006_hlasovani_seznam.py @@ -14,7 +14,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='hlasovani', name='seznam', - field=models.ForeignKey(default=1, to='prednasky.Seznam'), + field=models.ForeignKey(default=1, to='prednasky.Seznam', on_delete=models.CASCADE), preserve_default=False, ), ] diff --git a/prednasky/migrations/0011_auto_20190430_2340.py b/prednasky/migrations/0011_auto_20190430_2340.py new file mode 100644 index 00000000..a01d1878 --- /dev/null +++ b/prednasky/migrations/0011_auto_20190430_2340.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.20 on 2019-04-30 21:40 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('prednasky', '0010_auto_20160929_0508'), + ] + + operations = [ + migrations.AlterField( + model_name='hlasovani', + name='body', + field=models.IntegerField(choices=[(-1, '-1'), (0, '0'), (1, '1')], default=0, verbose_name='Body'), + ), + migrations.AlterField( + model_name='hlasovani', + name='ucastnik', + field=models.CharField(max_length=100, verbose_name='Účastník'), + ), + migrations.AlterField( + model_name='prednaska', + name='anotace', + field=models.TextField(blank=True, help_text='Veřejná anotace v hlasování', null=True, verbose_name='Anotace'), + ), + migrations.AlterField( + model_name='prednaska', + name='obtiznost', + field=models.IntegerField(choices=[(1, 'Lehká'), (2, 'Střední'), (3, 'Těžká')], verbose_name='Obtížnost'), + ), + migrations.AlterField( + model_name='seznam', + name='stav', + field=models.IntegerField(choices=[(1, 'Návrh'), (2, 'Bude')], default=1, verbose_name='Stav'), + ), + ] diff --git a/prednasky/migrations/0012_auto_20190610_2358.py b/prednasky/migrations/0012_auto_20190610_2358.py new file mode 100644 index 00000000..1ca6db83 --- /dev/null +++ b/prednasky/migrations/0012_auto_20190610_2358.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.21 on 2019-06-10 21:58 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('prednasky', '0011_auto_20190430_2340'), + ] + + operations = [ + migrations.AlterField( + model_name='hlasovani', + name='seznam', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='prednasky.Seznam'), + ), + migrations.AlterField( + model_name='prednaska', + name='org', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Organizator'), + ), + migrations.AlterField( + model_name='seznam', + name='soustredeni', + field=models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.PROTECT, to='seminar.Soustredeni'), + ), + ] diff --git a/seminar/migrations/0001_initial.py b/seminar/migrations/0001_initial.py index be1ba21e..088193b3 100644 --- a/seminar/migrations/0001_initial.py +++ b/seminar/migrations/0001_initial.py @@ -63,7 +63,7 @@ class Migration(migrations.Migration): 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')), + ('aktualni_cislo', models.ForeignKey(verbose_name='posledn\xed vydan\xe9 \u010d\xedslo', to='seminar.Cislo', on_delete=models.CASCADE)), ], options={ 'db_table': 'seminar_nastaveni', @@ -98,10 +98,10 @@ class Migration(migrations.Migration): ('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)), - ('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')), - ('cislo_zadani', models.ForeignKey(related_name='zadane_problemy', verbose_name='\u010d\xedslo zad\xe1n\xed', blank=True, to='seminar.Cislo', null=True)), - ('opravovatel', models.ForeignKey(related_name='opravovatel_uloh', verbose_name='opravovatel', blank=True, to=settings.AUTH_USER_MODEL, null=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', @@ -117,8 +117,8 @@ class Migration(migrations.Migration): ('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)), - ('problem', models.ForeignKey(related_name='reseni', verbose_name='probl\xe9m', to='seminar.Problem')), + ('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'], @@ -201,7 +201,7 @@ class Migration(migrations.Migration): ('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')), + ('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={ @@ -215,37 +215,37 @@ class Migration(migrations.Migration): migrations.AddField( model_name='resitel', name='skola', - field=models.ForeignKey(verbose_name='\u0161kola', blank=True, to='seminar.Skola', null=True), + 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'), + 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'), + 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'), + 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'), + 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'), + 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/0005_alter_problem_autor.py b/seminar/migrations/0005_alter_problem_autor.py index 264e9848..d8a40585 100644 --- a/seminar/migrations/0005_alter_problem_autor.py +++ b/seminar/migrations/0005_alter_problem_autor.py @@ -15,7 +15,7 @@ class Migration(migrations.Migration): 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), + 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/0013_soustredeni_ucastnici_through_model.py b/seminar/migrations/0013_soustredeni_ucastnici_through_model.py index 37027c2d..c725691d 100644 --- a/seminar/migrations/0013_soustredeni_ucastnici_through_model.py +++ b/seminar/migrations/0013_soustredeni_ucastnici_through_model.py @@ -16,8 +16,8 @@ class Migration(migrations.Migration): 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')), - ('soustredeni', models.ForeignKey(verbose_name='soust\u0159ed\u011bn\xed', to='seminar.Soustredeni')), + ('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'], diff --git a/seminar/migrations/0023_add_novinky.py b/seminar/migrations/0023_add_novinky.py index f8f7f960..7db2a005 100644 --- a/seminar/migrations/0023_add_novinky.py +++ b/seminar/migrations/0023_add_novinky.py @@ -21,7 +21,7 @@ class Migration(migrations.Migration): ('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)), + ('autor', models.ForeignKey(verbose_name=b'Autor novinky', to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)) ], options={ 'verbose_name': 'Novinka', diff --git a/seminar/migrations/0024_add_organizator.py b/seminar/migrations/0024_add_organizator.py index f9bf2cb8..16faee72 100644 --- a/seminar/migrations/0024_add_organizator.py +++ b/seminar/migrations/0024_add_organizator.py @@ -24,7 +24,7 @@ class Migration(migrations.Migration): ('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.')), + ('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', diff --git a/seminar/migrations/0036_add_org_to_soustredeni.py b/seminar/migrations/0036_add_org_to_soustredeni.py index cd6a2aed..4db43239 100644 --- a/seminar/migrations/0036_add_org_to_soustredeni.py +++ b/seminar/migrations/0036_add_org_to_soustredeni.py @@ -16,8 +16,8 @@ class Migration(migrations.Migration): 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')), - ('soustredeni', models.ForeignKey(verbose_name='soust\u0159ed\u011bn\xed', to='seminar.Soustredeni')), + ('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'], diff --git a/seminar/migrations/0037_prispevek.py b/seminar/migrations/0037_prispevek.py index fd3df05a..c4c3b867 100644 --- a/seminar/migrations/0037_prispevek.py +++ b/seminar/migrations/0037_prispevek.py @@ -19,8 +19,8 @@ class Migration(migrations.Migration): ('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')), - ('reseni', models.OneToOneField(null=True, blank=True, to='seminar.Reseni', verbose_name=b'\xc5\x98e\xc5\xa1en\xc3\xad')), + ('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/0039_pohadka.py b/seminar/migrations/0039_pohadka.py index 800be0e8..f798bd75 100644 --- a/seminar/migrations/0039_pohadka.py +++ b/seminar/migrations/0039_pohadka.py @@ -21,8 +21,8 @@ class Migration(migrations.Migration): ('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)), - ('uloha', models.ForeignKey(related_name='pohadky', verbose_name='\xdaloha', to='seminar.Problem')), + ('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'], diff --git a/seminar/migrations/0040_pohadka_nepovinny_autor.py b/seminar/migrations/0040_pohadka_nepovinny_autor.py index 092cb578..babf9b24 100644 --- a/seminar/migrations/0040_pohadka_nepovinny_autor.py +++ b/seminar/migrations/0040_pohadka_nepovinny_autor.py @@ -15,6 +15,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='pohadka', name='autor', - field=models.ForeignKey(verbose_name=b'Autor poh\xc3\xa1dky', to=settings.AUTH_USER_MODEL, null=True), + 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 index e0adaa2d..9fddbe17 100644 --- a/seminar/migrations/0041_konfery.py +++ b/seminar/migrations/0041_konfery.py @@ -37,8 +37,9 @@ class Migration(migrations.Migration): 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')), - ('resitel', models.ForeignKey(verbose_name='\u0159e\u0161itel', to='seminar.Resitel')), + ('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'], 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í'), + ), + ] From 5f6c0e668329e72dc09eb1d871192085146b2e97 Mon Sep 17 00:00:00 2001 From: LEdoian Date: Tue, 11 Jun 2019 01:18:09 +0200 Subject: [PATCH 4/9] =?UTF-8?q?N=C3=A1hodn=C3=A9=20Martinovo=20pozorov?= =?UTF-8?q?=C3=A1n=C3=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seminar/models.py | 1 + 1 file changed, 1 insertion(+) diff --git a/seminar/models.py b/seminar/models.py index 760c5c57..ca630c70 100644 --- a/seminar/models.py +++ b/seminar/models.py @@ -1003,6 +1003,7 @@ class Konfera(models.Model): organizator = models.ForeignKey(Organizator, verbose_name='organizátor', related_name='konfery', on_delete = models.SET_NULL, null=True) + # FIXME: Umíme omezit jen na účastníky daného soustřeďka? ucastnici = models.ManyToManyField(Resitel, verbose_name='účastníci konfery', help_text='Seznam účastníků konfery', through='Konfery_Ucastnici') From 5c6b49eefcceea0cc4b8ab9e502127e55ddcaf74 Mon Sep 17 00:00:00 2001 From: "Tomas \"Jethro\" Pokorny" Date: Tue, 11 Jun 2019 01:26:12 +0200 Subject: [PATCH 5/9] Django 2.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit URL jsou rozbité, vždy zobrazí titulku, ale běží. --- korektury/views.py | 8 ++-- mamweb/settings_common.py | 5 ++- mamweb/urls.py | 18 ++++---- mamweb/wsgi.py | 21 +++------ requirements.txt | 40 ++++++++--------- seminar/templatetags/mam_menu.py | 2 +- seminar/urls.py | 76 ++++++++++++++++---------------- 7 files changed, 80 insertions(+), 90 deletions(-) diff --git a/korektury/views.py b/korektury/views.py index d00da453..6a46b42c 100644 --- a/korektury/views.py +++ b/korektury/views.py @@ -23,10 +23,10 @@ class KorekturyListView(generic.ListView): model = KorekturovanePDF # Nefunguje, filtry se vubec nepouziji queryset = KorekturovanePDF.objects.annotate( - k_oprave_cnt=Count('oprava',filter=Q(oprava__status='k_oprave')), - opraveno_cnt=Count('oprava',filter=Q(oprava__status='opraveno')), - neni_chyba_cnt=Count('oprava',filter=Q(oprava__status='neni_chyba')), - k_zaneseni_cnt=Count('oprava',filter=Q(oprava__status='k_zaneseni')), + k_oprave_cnt=Count('oprava',distinct=True,filter=Q(oprava__status='k_oprave')), + opraveno_cnt=Count('oprava',distinct=True,filter=Q(oprava__status='opraveno')), + neni_chyba_cnt=Count('oprava',distinct=True,filter=Q(oprava__status='neni_chyba')), + k_zaneseni_cnt=Count('oprava',distinct=True,filter=Q(oprava__status='k_zaneseni')), ) template_name = 'korektury/seznam.html' diff --git a/mamweb/settings_common.py b/mamweb/settings_common.py index 87d01f37..6201d348 100644 --- a/mamweb/settings_common.py +++ b/mamweb/settings_common.py @@ -57,9 +57,10 @@ MIDDLEWARE = ( 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', - 'mamweb.middleware.LoggedInHintCookieMiddleware', +# FIXME: rozbilo se při přechodu na Django 2.0, nevím, jestli +# se to dá zahodit bez náhrady +# 'mamweb.middleware.LoggedInHintCookieMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', - 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware', diff --git a/mamweb/urls.py b/mamweb/urls.py index 4d4df748..26646528 100644 --- a/mamweb/urls.py +++ b/mamweb/urls.py @@ -9,29 +9,29 @@ from django import views urlpatterns = [ # Admin a nastroje - url(r'^admin/', include(admin.site.urls)), # NOQA - url(r'^ckeditor/', include('ckeditor_uploader.urls')), - url(r'^autocomplete/', include('autocomplete_light.urls')), + url('admin/', admin.site.urls), # NOQA + url('ckeditor/', include('ckeditor_uploader.urls')), + url('autocomplete/', include('autocomplete_light.urls')), # Seminarova aplikace (ma vlastni podadresare) - url(r'^', include('seminar.urls')), + url('', include('seminar.urls')), # Korekturovaci aplikace (ma vlastni podadresare) - url(r'^', include('korektury.urls')), + url('', include('korektury.urls')), # Prednaskova aplikace (ma vlastni podadresare) - url(r'^', include('prednasky.urls')), + url('', include('prednasky.urls')), # Comments (interni i verejne) - url(r'^comments_dj/', include('django_comments.urls')), - url(r'^comments_fl/', include('fluent_comments.urls')), + url('comments_dj/', include('django_comments.urls')), + url('comments_fl/', include('fluent_comments.urls')), ] # This is only needed when using runserver. if settings.DEBUG: urlpatterns += [ - url(r'^media/(?P.*)$', views.static.serve, # NOQA + url('media/', views.static.serve, # NOQA {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}), ] urlpatterns += staticfiles_urlpatterns() diff --git a/mamweb/wsgi.py b/mamweb/wsgi.py index b2c0c787..ddb7f25c 100644 --- a/mamweb/wsgi.py +++ b/mamweb/wsgi.py @@ -4,25 +4,14 @@ WSGI config for mamweb project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see -https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/ +https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/ """ -import sys, os, os.path, traceback, time, signal -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mamweb.settings") - -sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) -sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'lib', 'python2.7', 'site-packages'))) +import os +from django.core.wsgi import get_wsgi_application -try: - from django.core.wsgi import get_wsgi_application - application = get_wsgi_application() +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mamweb.settings") -except Exception: - print('handling WSGI exception') - # Error loading applications - if 'mod_wsgi' in sys.modules: - traceback.print_exc() - os.kill(os.getpid(), signal.SIGINT) - time.sleep(2) +application = get_wsgi_application() diff --git a/requirements.txt b/requirements.txt index 25d438d1..c39037fd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,30 +1,30 @@ # basic libs -psycopg2==2.7.5 -html5lib==1.0.1 -ipython==5.8.0 -Pillow==5.2.0 -pytz==2018.5 -six==1.10.0 -pexpect==4.6.0 -traitlets==4.3.2 -Unidecode==1.0.22 +psycopg2 +html5lib +ipython +Pillow +pytz +six +pexpect +traitlets +Unidecode # Django and modules -Django>=1.11.17,<2.0 +Django<2.3 #django-bootstrap-sass -django-mptt==0.9.1 -django-reversion==2.0.13 -django-sekizai==0.10.0 -django-countries==5.3.1 -django-solo==1.1.3 -django-ckeditor==5.6.1 -django-flat-theme==1.1.4 -django-taggit==0.23.0 +django-mptt +django-reversion +django-sekizai +django-countries +django-solo +django-ckeditor +django-flat-theme +django-taggit django-autocomplete-light==2.3.6 -django-crispy-forms==1.7.2 -django-imagekit==4.0.2 +django-crispy-forms +django-imagekit # Comments akismet==1.0.1 diff --git a/seminar/templatetags/mam_menu.py b/seminar/templatetags/mam_menu.py index bf0ec3d4..9ae7ac68 100644 --- a/seminar/templatetags/mam_menu.py +++ b/seminar/templatetags/mam_menu.py @@ -10,6 +10,6 @@ def seminar_rocniky(parser, token): 'rocniky': Rocnik.objects.all() } -@register.assignment_tag +@register.simple_tag def aktualni_rocniky(): return Rocnik.objects.all() diff --git a/seminar/urls.py b/seminar/urls.py index aa41c386..6574f88c 100644 --- a/seminar/urls.py +++ b/seminar/urls.py @@ -9,105 +9,105 @@ staff_member_required = user_passes_test(lambda u: u.is_staff) urlpatterns = [ # REDIRECTy - url(r'^jak-resit/$', RedirectView.as_view(url='/co-je-MaM/jak-resit/')), + url('jak-resit/', RedirectView.as_view(url='/co-je-MaM/jak-resit/')), # Organizatori - url(r'^co-je-MaM/organizatori/$', views.CojemamOrganizatoriView.as_view(), name='organizatori'), - url(r'^co-je-MaM/organizatori/organizovali/$', views.CojemamOrganizatoriStariView.as_view(), name='stari_organizatori'), + url('co-je-MaM/organizatori/', views.CojemamOrganizatoriView.as_view(), name='organizatori'), + url('co-je-MaM/organizatori/organizovali/', views.CojemamOrganizatoriStariView.as_view(), name='stari_organizatori'), # Archiv - url(r'^archiv/cisla/$', views.ArchivView.as_view()), - url(r'^archiv/temata/$', views.ArchivTemataView.as_view()), + url('archiv/cisla/', views.ArchivView.as_view()), + url('archiv/temata/', views.ArchivTemataView.as_view()), - url(r'^rocnik/(?P\d+)/$', views.RocnikView.as_view(), name='seminar_rocnik'), - #url(r'^cislo/(?P\d+)\.(?P[0-9-]+)/$', views.CisloView.as_view(), name='seminar_cislo'), - url(r'^problem/(?P\d+)/$', views.ProblemView.as_view(), name='seminar_problem'), - #url(r'^problem/(?P\d+)/(?P\d+)/$', views.PrispevekView.as_view(), name='seminar_problem_prispevek'), + url('rocnik//', views.RocnikView.as_view(), name='seminar_rocnik'), + #url('cislo/./', views.CisloView.as_view(), name='seminar_cislo'), + url('problem//', views.ProblemView.as_view(), name='seminar_problem'), + #url('problem/(?P\d+)/(?P\d+)/', views.PrispevekView.as_view(), name='seminar_problem_prispevek'), # Soustredeni url( - r'^soustredeni/probehlo/$', + 'soustredeni/probehlo/', views.SoustredeniListView.as_view(), name='seminar_seznam_soustredeni' ), url( - r'^soustredeni/probehlo/(?P\d+)/$', + 'soustredeni/probehlo//', views.SoustredeniView.as_view(), name='seminar_soustredeni' ), url( - r'^soustredeni/(?P\d+)/seznam_ucastniku$', + 'soustredeni//seznam_ucastniku', staff_member_required(views.SoustredeniUcastniciView.as_view()), name='soustredeni_ucastnici' ), url( - r'^soustredeni/(?P\d+)/maily_ucastniku$', + 'soustredeni//maily_ucastniku', staff_member_required(views.SoustredeniMailyUcastnikuView.as_view()), name='maily_ucastniku' ), url( - r'^soustredeni/(?P\d+)/stvrzenky/(?P\d+)$', + 'soustredeni//stvrzenky/', staff_member_required(views.soustredeniStvrzenkyExportView), name='soustredeni_stvrzenky' ), url( - r'^soustredeni/(?P\d+)/export_ucastniku$', + 'soustredeni//export_ucastniku', staff_member_required(views.soustredeniUcastniciExportView), name='soustredeni_ucastnici_export' ), url( - r'^soustredeni/(?P\d+)/fotogalerie/', + 'soustredeni//fotogalerie/', include('galerie.urls') ), # Zadani - url(r'^zadani/aktualni/$', views.AktualniZadaniView, name='seminar_aktualni_zadani'), - url(r'^zadani/temata/$', views.ZadaniTemataView, name='seminar_temata'), - #url(r'^zadani/vysledkova-listina/$', views.ZadaniAktualniVysledkovkaView, name='seminar_vysledky'), - url(r'^$', views.TitulniStranaView.as_view(), name='titulni_strana'), - url(r'^stare-novinky/$', views.StareNovinkyView.as_view(), name='stare_novinky'), + url('zadani/aktualni/', views.AktualniZadaniView, name='seminar_aktualni_zadani'), + url('zadani/temata/', views.ZadaniTemataView, name='seminar_temata'), + #url('zadani/vysledkova-listina/', views.ZadaniAktualniVysledkovkaView, name='seminar_vysledky'), + url('', views.TitulniStranaView.as_view(), name='titulni_strana'), + url('stare-novinky/', views.StareNovinkyView.as_view(), name='stare_novinky'), # Clanky - url(r'^clanky/resitel/$', views.ClankyResitelView.as_view(), name='clanky_resitel'), - #url(r'^clanky/org/$', views.ClankyOrganizatorView.as_view(), name='clanky_organizator'), + url('clanky/resitel/', views.ClankyResitelView.as_view(), name='clanky_resitel'), + #url('clanky/org/', views.ClankyOrganizatorView.as_view(), name='clanky_organizator'), # Aesop - url(r'^aesop-export/mam-rocnik-(?P\d+)\.csv$', export.ExportRocnikView.as_view(), name='seminar_export_rocnik'), - url(r'^aesop-export/mam-sous-(?P[\d-]+)\.csv$', export.ExportSousView.as_view(), name='seminar_export_sous'), - url(r'^aesop-export/index.csv$', export.ExportIndexView.as_view(), name='seminar_export_index'), + url('aesop-export/mam-rocnik-.csv', export.ExportRocnikView.as_view(), name='seminar_export_rocnik'), + url('aesop-export/mam-sous-.csv', export.ExportSousView.as_view(), name='seminar_export_sous'), + url('aesop-export/index.csv', export.ExportIndexView.as_view(), name='seminar_export_index'), # Stranky viditelne pouze pro orgy: #url( - # r'^rocnik/(?P\d+)/vysledkovka.tex$', + # 'rocnik/(?P\d+)/vysledkovka.tex', # staff_member_required(views.RocnikVysledkovkaView.as_view()), # name='seminar_cislo_vysledkovka' #), - #url(r'^cislo/(?P\d+).(?P[0-9-]+)/vysledkovka.tex$', + #url('cislo/(?P\d+).(?P[0-9-]+)/vysledkovka.tex', # staff_member_required(views.CisloVysledkovkaView.as_view()), name='seminar_cislo_vysledkovka'), - url(r'^cislo/(?P\d+).(?P[0-9-]+)/obalky.pdf$', + url('cislo/./obalky.pdf', staff_member_required(views.cisloObalkyView), name='seminar_cislo_obalky'), - #url(r'^cislo/(?P\d+).(?P[0-9-]+)/tituly.tex$', + #url('cislo/(?P\d+).(?P[0-9-]+)/tituly.tex', # staff_member_required(views.TitulyView), name='seminar_cislo_titul'), - url(r'^stav$', + url('stav', staff_member_required(views.StavDatabazeView), name='stav_databaze'), - url(r'^cislo/(?P\d+).(?P[0-9-]+)/obalkovani$', + url('cislo/./obalkovani', staff_member_required(views.obalkovaniView), name='seminar_cislo_resitel_obalkovani'), - url(r'^cislo/(?P\d+).(?P[0-9-]+)/tex-download.json$', + url('cislo/./tex-download.json', staff_member_required(views.texDownloadView), name='seminar_tex_download'), - url(r'^soustredeni/(?P\d+)/obalky.pdf', + url('soustredeni//obalky.pdf', staff_member_required(views.soustredeniObalkyView), name='seminar_soustredeni_obalky'), - url(r'^tex-upload/login/$', views.LoginView, name='seminar_login'), + url('tex-upload/login/', views.LoginView, name='seminar_login'), url( - r'^tex-upload/$', + 'tex-upload/', staff_member_required(views.texUploadView), name='seminar_tex_upload' ), - url(r'^prihlaska/$',views.get_name), + url('prihlaska/',views.get_name), # Ceka na autocomplete v3 - # url(r'^autocomplete/organizatori/$', + # url('autocomplete/organizatori/', # staff_member_required(views.OrganizatorAutocomplete.as_view()), # name='seminar_autocomplete_organizator') From 64495b63901016e75a5393ccc85a28f268b95146 Mon Sep 17 00:00:00 2001 From: "Tomas \"Jethro\" Pokorny" Date: Tue, 11 Jun 2019 01:32:02 +0200 Subject: [PATCH 6/9] Bugfix --- seminar/urls.py | 1 - 1 file changed, 1 deletion(-) diff --git a/seminar/urls.py b/seminar/urls.py index cfdaf369..3d82e8ac 100644 --- a/seminar/urls.py +++ b/seminar/urls.py @@ -45,7 +45,6 @@ urlpatterns = [ staff_member_required(views.SoustredeniMailyUcastnikuView.as_view()), name='maily_ucastniku' ), - url( url( 'soustredeni//export_ucastniku', staff_member_required(views.soustredeniUcastniciExportView), From b3464a582f427b0bfafcbea30be368b12969447e Mon Sep 17 00:00:00 2001 From: "Martin Z. (Zimamazim)" Date: Tue, 11 Jun 2019 01:34:20 +0200 Subject: [PATCH 7/9] =?UTF-8?q?P=C5=99id=C3=A1na=20funkce=20gen=5Fkonfery?= =?UTF-8?q?=20Upravena=20funkce=20pro=20generov=C3=A1n=C3=AD=20soust=C5=99?= =?UTF-8?q?ed=C4=9Bn=C3=AD=20P=C5=99id=C3=A1n=20bal=C3=AD=C4=8Dek=20lorem?= =?UTF-8?q?=20pro=20generov=C3=A1n=C3=AD=20Lorem=20Ipsum=20do=20testdat?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seminar/testutils.py | 46 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 10 deletions(-) diff --git a/seminar/testutils.py b/seminar/testutils.py index c52e3bea..ee08530f 100644 --- a/seminar/testutils.py +++ b/seminar/testutils.py @@ -2,11 +2,12 @@ import datetime import random +import lorem import django.contrib.auth from django.db import transaction import unidecode -from seminar.models import Skola, Resitel, Rocnik, Cislo, Problem, Reseni, PrilohaReseni, Nastaveni, Soustredeni, Soustredeni_Ucastnici, Osoba, Organizator, Prijemce, Tema, Uloha +from seminar.models import Skola, Resitel, Rocnik, Cislo, Problem, Reseni, PrilohaReseni, Nastaveni, Soustredeni, Soustredeni_Ucastnici, Soustredeni_Organizatori, Osoba, Organizator, Prijemce, Tema, Uloha, Konfera, KonferaNode, Konfera_Ucastnici from django.contrib.flatpages.models import FlatPage from django.contrib.sites.models import Site @@ -206,22 +207,25 @@ def gen_ulohy_do_cisla(rnd, cislo, organizatori, resitele, slovnik_cisel, size): ) return -def gen_soustredeni(): - sousy = [] +# FIXME Každé funkci se předává nějaké rnd, netuším, co to je. Pokud to tam má být, tak to tam přijdejte, pokud ne, tak je tato poznámka bezpředmětná. +def gen_soustredeni(resitele, organizatori): + soustredeni = [] for sousi in range(1, size): #FIXME Tu range si změňte jak chcete, nevím, co přesně znamená size (asi Anet?) datum_zacatku=datetime.date(randint(2000, 2020), randint(1, 12), radint(1, 28)) - working_sous = Soustredeni.objects.create(rocnik=Rocnik.objects.order_by('?').first(), - verejne_db=rnd.choice([True, False]), - misto=rnd.choice(['Kremrolovice', 'Indiánov', 'U zmzliny', 'Vafláreň', 'Větrník', 'Horní Rakvička', 'Dolní cheesecake']), - datum_zacatku=datum_zacatku, - datum_konce=datum_zacatku + datetime.timedelta(weeks=1)) + working_sous = Soustredeni.objects.create( + rocnik=Rocnik.objects.order_by('?').first(), + verejne_db=rnd.choice([True, False]), + misto=rnd.choice(['Kremrolovice', 'Indiánov', 'U zmzliny', 'Vafláreň', 'Větrník', 'Horní Rakvička', 'Dolní cheesecake']), + typ=rnd.choice(['jarni', 'podzmini', 'vikend']), + datum_zacatku=datum_zacatku, + datum_konce=datum_zacatku + datetime.timedelta(weeks=1)) for res in rnd.sample(resitele, min(len(resitele), 20)): Soustredeni_Ucastnici.objects.create(resitel=res, soutredeni=working_sous) for org in rnd.sample(organizatori, min(len(organizatori), 20)): Soustredeni_Organizatori.objects.create(organizator=org, soutredeni=working_sous) working_sous.save() - sousy.append(working_sous) - return sousy + soustredeni.append(working_sous) + return soustredeni def gen_rocniky(last_rocnik, size): rocniky = [] @@ -233,6 +237,28 @@ def gen_rocniky(last_rocnik, size): rocniky.append(rocnik) return rocniky +# FIXME Každé funkci se předává nějaké rnd, netuším, co to je. Pokud to tam má být, tak to tam přijdejte, pokud ne, tak je tato poznámka bezpředmětná. +def gen_konfery(organizatori, ucastnici, soustredeni): + konfery = [] + for konferai in range(1, size): #FIXME Tu range si změňte jak chcete, nevím, co přesně znamená size (asi Anet?) + konfera = Konfera.objects.create( + nazev=rnd.choice(['Pozorování', 'Zkoumání', 'Modelování', 'Počítání', 'Zkoušení']) + rnd.choice(' vlastností', ' jevů', ' charakteristik']) + rnd.choice([' vektorových prostorů', ' kinetické terorie látek', ' molekulární biologie', ' syntentických stromů']), + anotace=lorem.paragraph(), + abstrakt=lorem.paragraph(), + organizator=rnd.choice(organizatori), + ucastnici=rnd.choice(ucastnici), + soustredeni=rnd.choice(soustredeni), + reseni=rnd.choice(reseni), + typ_prezentace=rnd.choice(['veletrh', 'prezentace'])) + for res in rnd.sample(resitele, min(len(resitele), randint(3, 6))): + Konfery_Ucastnici.objects.create(resitel=res, konfera=konfera) + konfery.append(konfera) + konfera.save() + + konferanode = KonferaNode.objects.create(konfera=konfera) + konferanode.save() + return konfery + def gen_cisla(rocniky): slovnik_rocnik_cisla = {} for rocnik in rocniky: From 3f5d642cf381f5510dfec57f9ddf307ab6a1993b Mon Sep 17 00:00:00 2001 From: "Martin Z. (Zimamazim)" Date: Tue, 11 Jun 2019 01:37:25 +0200 Subject: [PATCH 8/9] =?UTF-8?q?P=C5=99id=C3=A1n=20bal=C3=AD=C4=8Dek=20lore?= =?UTF-8?q?m=20pro=20generov=C3=A1n=C3=AD=20Lorem=20Ipsum=20do=20testdat?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- requirements.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/requirements.txt b/requirements.txt index 25d438d1..45070bfb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -49,3 +49,7 @@ Werkzeug==0.14.1 # uWSGI uWSGI==2.0.17.1 + +# Potřeba pro test data + +lorem From 09161f169c8472649e69d36b587ee374df0a9bf2 Mon Sep 17 00:00:00 2001 From: "Martin Z. (Zimamazim)" Date: Tue, 11 Jun 2019 01:50:50 +0200 Subject: [PATCH 9/9] Fix v gen_konfery a gen_soustredeni --- seminar/testutils.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/seminar/testutils.py b/seminar/testutils.py index ee08530f..1f788306 100644 --- a/seminar/testutils.py +++ b/seminar/testutils.py @@ -207,10 +207,9 @@ def gen_ulohy_do_cisla(rnd, cislo, organizatori, resitele, slovnik_cisel, size): ) return -# FIXME Každé funkci se předává nějaké rnd, netuším, co to je. Pokud to tam má být, tak to tam přijdejte, pokud ne, tak je tato poznámka bezpředmětná. -def gen_soustredeni(resitele, organizatori): +def gen_soustredeni(rnd, resitele, organizatori): soustredeni = [] - for sousi in range(1, size): #FIXME Tu range si změňte jak chcete, nevím, co přesně znamená size (asi Anet?) + for _ in range(1, size): #FIXME Tu range si změňte jak chcete, nevím, co přesně znamená size (asi Anet?) datum_zacatku=datetime.date(randint(2000, 2020), randint(1, 12), radint(1, 28)) working_sous = Soustredeni.objects.create( rocnik=Rocnik.objects.order_by('?').first(), @@ -237,20 +236,18 @@ def gen_rocniky(last_rocnik, size): rocniky.append(rocnik) return rocniky -# FIXME Každé funkci se předává nějaké rnd, netuším, co to je. Pokud to tam má být, tak to tam přijdejte, pokud ne, tak je tato poznámka bezpředmětná. -def gen_konfery(organizatori, ucastnici, soustredeni): +def gen_konfery(rnd, reseni, organizatori, ucastnici, soustredeni): konfery = [] - for konferai in range(1, size): #FIXME Tu range si změňte jak chcete, nevím, co přesně znamená size (asi Anet?) + for _ in range(1, size): #FIXME Tu range si změňte jak chcete, nevím, co přesně znamená size (asi Anet?) konfera = Konfera.objects.create( nazev=rnd.choice(['Pozorování', 'Zkoumání', 'Modelování', 'Počítání', 'Zkoušení']) + rnd.choice(' vlastností', ' jevů', ' charakteristik']) + rnd.choice([' vektorových prostorů', ' kinetické terorie látek', ' molekulární biologie', ' syntentických stromů']), anotace=lorem.paragraph(), abstrakt=lorem.paragraph(), organizator=rnd.choice(organizatori), - ucastnici=rnd.choice(ucastnici), soustredeni=rnd.choice(soustredeni), reseni=rnd.choice(reseni), typ_prezentace=rnd.choice(['veletrh', 'prezentace'])) - for res in rnd.sample(resitele, min(len(resitele), randint(3, 6))): + for res in rnd.sample(ucastnici, min(len(ucastnici), randint(3, 6))): Konfery_Ucastnici.objects.create(resitel=res, konfera=konfera) konfery.append(konfera) konfera.save()