Přidána funkce gen_konfery
Upravena funkce pro generování soustředění Přidán balíček lorem pro generování Lorem Ipsum do testdat
This commit is contained in:
		
							parent
							
								
									1418d63897
								
							
						
					
					
						commit
						b3464a582f
					
				
					 1 changed files with 36 additions and 10 deletions
				
			
		|  | @ -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: | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue
	
	 Martin Z. (Zimamazim)
						Martin Z. (Zimamazim)