Web M&M
https://mam.matfyz.cz
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
747 B
28 lines
747 B
4 months ago
|
import logging
|
||
|
|
||
|
from .models import Novinky
|
||
|
|
||
|
logger = logging.getLogger(__name__)
|
||
|
|
||
|
|
||
|
def gen_novinky(rnd, organizatori):
|
||
|
logger.info('Generuji novinky...')
|
||
|
|
||
|
jake = ["zábavné", "veselé", "dobrodružné", "skvělé"]
|
||
|
co = ["soustředění", "Fyziklání", "víkendové setkání"]
|
||
|
kde = ["na Šumavě", "v Praze", "u Plzně", "na Marsu"]
|
||
|
kdy = ["Zítra bude", "10. 10. 2020 bude", "V prosinci bude", "V létě bude"]
|
||
|
|
||
|
for i in range(5):
|
||
|
text_novinky = " ".join([
|
||
|
rnd.choice(kdy), rnd.choice(kde),
|
||
|
rnd.choice(jake), rnd.choice(co),
|
||
|
])
|
||
|
novinka = Novinky.objects.create(
|
||
|
id=i, autor=rnd.choice(organizatori),
|
||
|
text=(text_novinky+", těšíme se na vás!"),
|
||
|
zverejneno=rnd.choice([True, False]),
|
||
|
)
|
||
|
novinka.save()
|
||
|
return
|