Merge branch 'data_migrations' of gimli.ms.mff.cuni.cz:/akce/mam/git/mamweb into data_migrations
This commit is contained in:
commit
5a09d185d8
8 changed files with 63 additions and 30 deletions
|
@ -13,8 +13,8 @@
|
|||
<script src="{% static 'js/jquery-1.11.1.js' %}"></script>
|
||||
{% include 'autocomplete_light/static.html' %}
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}fluent_comments/css/ajaxcomments.css" />
|
||||
<script type="text/javascript" src="{{ STATIC_URL }}fluent_comments/js/ajaxcomments.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'fluent_comments/css/ajaxcomments.css' %}" />
|
||||
<script type="text/javascript" src="{% static 'fluent_comments/js/ajaxcomments.js' %}"></script>
|
||||
|
||||
{# nastavení MathJaxu, aby nahrazoval i matiku obalenou jednoduchými $ #}
|
||||
<script type="text/x-mathjax-config">
|
||||
|
|
|
@ -1162,6 +1162,14 @@ class TreeNode(models.Model):
|
|||
blank = True,
|
||||
on_delete=models.SET_NULL,
|
||||
verbose_name="další element na stejné úrovni")
|
||||
|
||||
def print_tree(self,indent=0):
|
||||
print("{}TreeNode({})".format(" "*indent,self.id))
|
||||
if self.first_child:
|
||||
self.first_child.print_tree(indent=indent+2)
|
||||
if self.succ:
|
||||
self.succ.print_tree(indent=indent)
|
||||
|
||||
|
||||
class RocnikNode(TreeNode):
|
||||
class Meta:
|
||||
|
@ -1387,4 +1395,7 @@ class Novinky(models.Model):
|
|||
zverejneno = models.BooleanField('Zveřejněno', default=False)
|
||||
|
||||
def __str__(self):
|
||||
return '[' + str(self.datum) + '] ' + self.text[0:50]
|
||||
if self.text:
|
||||
return '[' + str(self.datum) + '] ' + self.text[0:50]
|
||||
else:
|
||||
return '[' + str(self.datum) + '] '
|
||||
|
|
|
@ -96,25 +96,29 @@
|
|||
|
||||
|
||||
{% for r in resitele %}
|
||||
{% with o=r.osoba %}
|
||||
{% with s=r.osoba.skola %}
|
||||
{% spaceless %}
|
||||
{% if r.zasilat == "do_skoly" %}
|
||||
{% if r.stat == "CZ" %}
|
||||
\obalka{{r.jmeno|sloz}}{{r.prijmeni|sloz}}{{r.skola.nazev|sloz}}{{r.skola.ulice|sloz}}{{r.skola.psc|sloz}}{{r.skola.mesto|sloz}}{{''|sloz}}
|
||||
\obalka{{o.jmeno|sloz}}{{o.prijmeni|sloz}}{{s.nazev|sloz}}{{s.ulice|sloz}}{{s.psc|sloz}}{{s.mesto|sloz}}{{''|sloz}}
|
||||
{% else %}
|
||||
\obalka{{r.jmeno|sloz}}{{r.prijmeni|sloz}}{{r.skola.nazev|sloz}}{{r.skola.ulice|sloz}}{{r.skola.psc|sloz}}{{r.skola.mesto|sloz}}{{r.stat.name|sloz}}
|
||||
\obalka{{o.jmeno|sloz}}{{o.prijmeni|sloz}}{{s.nazev|sloz}}{{s.ulice|sloz}}{{s.psc|sloz}}{{s.mesto|sloz}}{{o.stat.name|sloz}}
|
||||
{% endif %}
|
||||
|
||||
{% elif r.zasilat == "domu" %}
|
||||
{% if r.stat == "CZ" %}
|
||||
\obalka{{r.jmeno|sloz}}{{r.prijmeni|sloz}}{{''|sloz}}{{r.ulice|sloz}}{{r.psc|sloz}}{{r.mesto|sloz}}{{''|sloz}}
|
||||
\obalka{{o.jmeno|sloz}}{{o.prijmeni|sloz}}{{''|sloz}}{{o.ulice|sloz}}{{o.psc|sloz}}{{o.mesto|sloz}}{{''|sloz}}
|
||||
{% else %}
|
||||
\obalka{{r.jmeno|sloz}}{{r.prijmeni|sloz}}{{''|sloz}}{{r.ulice|sloz}}{{r.psc|sloz}}{{r.mesto|sloz}}{{r.stat.name|sloz}}
|
||||
\obalka{{o.jmeno|sloz}}{{o.prijmeni|sloz}}{{''|sloz}}{{o.ulice|sloz}}{{o.psc|sloz}}{{o.mesto|sloz}}{{o.stat.name|sloz}}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
% zasilat: {{r.zasilat}}
|
||||
%\obalka{{r.jmeno|sloz}}{{r.prijmeni|sloz}}{{''|sloz}}{{r.ulice|sloz}}{{r.psc|sloz}}{{r.mesto|sloz}}{{r.stat.name|sloz}}
|
||||
{% endif %}
|
||||
{% endspaceless %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endfor %}
|
||||
\end{document}
|
||||
|
||||
|
|
|
@ -25,40 +25,40 @@
|
|||
{% endif %}
|
||||
{% for org in object_list %}
|
||||
<h1>
|
||||
{{org.user.first_name}}
|
||||
{{org.osoba.jmeno}}
|
||||
{% if org.prezdivka %}
|
||||
„{{org.prezdivka}}“
|
||||
„{{org.osoba.prezdivka}}“
|
||||
{% endif %}
|
||||
{{org.user.last_name}}
|
||||
{{org.osoba.prijmeni}}
|
||||
</h1>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="foto_org">
|
||||
{% if org.foto %}
|
||||
{# <img src="{{org.foto.url}}" height="{{org.foto.height}}"> #}
|
||||
<a href="{{org.foto.url}}"><img src="{{org.foto_male.url}}" height="{{org.foto_male.height}}" alt="{{org.user.first_name}} {{org.user.last_name}}"></a>
|
||||
{% if org.osoba.foto %}
|
||||
{# <img src="{{org.osoba.foto.url}}" height="{{org.osoba.foto.height}}"> #}
|
||||
<a href="{{org.osoba.foto.url}}"><img src="{{org.osoba.foto_male.url}}" height="{{org.osoba.foto_male.height}}" alt="{{org.osoba.jmeno}} {{org.osoba.prijmeni}}"></a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<ul>
|
||||
{% if aktivni %}
|
||||
{% if org.organizuje_od_roku %}
|
||||
{% if org.organizuje_od %}
|
||||
<li>
|
||||
Organizuje od roku {{org.organizuje_od_roku}}
|
||||
Organizuje od roku {{org.organizuje_od}}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<li>
|
||||
Aktivní v letech {{org.organizuje_od_roku | default:"?" }}–{{org.organizuje_do_roku | default:"?" }}
|
||||
Aktivní v letech {{org.organizuje_od | default:"?" }}–{{org.organizuje_do | default:"?" }}
|
||||
{% endif %}
|
||||
{% if org.studuje %}
|
||||
<li>{{org.studuje}}
|
||||
{% if org.skola %}
|
||||
<li>{{org.studuje}} na {{org.skola}}
|
||||
{% endif %}
|
||||
{% if org.user.email %}
|
||||
{% if org.osoba.email %}
|
||||
<li>Pošta:
|
||||
{# zobrazeni e-mailu (na jednom radku, aby nevznikaly mezery navic) #}
|
||||
{% for znak in org.user.email %}{% if znak == '@' %} <zavináč> {% elif znak == '.' %} <tečka> {% else %}{{znak}}{% endif %}{% endfor %}
|
||||
{% for znak in org.osoba.email %}{% if znak == '@' %} <zavináč> {% elif znak == '.' %} <tečka> {% else %}{{znak}}{% endif %}{% endfor %}
|
||||
{% endif %}
|
||||
</ul>
|
||||
{# {{org.strucny_popis_organizatora}} #}
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
<a href="../{{soustredeni.pk}}/seznam_ucastniku">HTML tabulka pro tisk</a>,
|
||||
<a href="../{{soustredeni.pk}}/export_ucastniku">CSV</a>,
|
||||
<a href="../{{soustredeni.pk}}/maily_ucastniku">E-maily</a><br>
|
||||
<a href="../{{soustredeni.pk}}/stvrzenky/42">Stvrzenky <i>(42 v URL nahraďte prvním číslem z rozsahu)</i></a>
|
||||
<!--a href="../{{soustredeni.pk}}/stvrzenky/42">Stvrzenky <i>(42 v URL nahraďte prvním číslem z rozsahu)</i></a!-->
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
<tr>
|
||||
<td nowrap>{{sous_ucast.resitel}}</td>
|
||||
<td nowrap>{{sous_ucast.resitel.rok_maturity}}</td>
|
||||
<td nowrap>{{sous_ucast.resitel.telefon}}</td>
|
||||
<td nowrap>{{sous_ucast.resitel.osoba.telefon}}</td>
|
||||
<td nowrap>{{sous_ucast.poznamka}}</td>
|
||||
<td class="fill"></td>
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ 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, Soustredeni_Organizatori, Osoba, Organizator, Prijemce, Tema, Uloha, Konfera, KonferaNode, TextNode, UlohaVzorakNode, RocnikNode, CisloNode, TemaVCisleNode, Text, Hodnoceni, UlohaZadaniNode
|
||||
from seminar.models import Skola, Resitel, Rocnik, Cislo, Problem, Reseni, PrilohaReseni, Nastaveni, Soustredeni, Soustredeni_Ucastnici, Soustredeni_Organizatori, Osoba, Organizator, Prijemce, Tema, Uloha, Konfera, KonferaNode, TextNode, UlohaVzorakNode, RocnikNode, CisloNode, TemaVCisleNode, Text, Hodnoceni, UlohaZadaniNode, Novinky
|
||||
|
||||
from django.contrib.flatpages.models import FlatPage
|
||||
from django.contrib.sites.models import Site
|
||||
|
@ -23,7 +23,7 @@ def gen_osoby(rnd, size):
|
|||
'Pokora', 'Koch', 'Szegedy', 'Rudý', "von Neumann", "d'Este"]
|
||||
prijmeni_f = ['Novotná', 'Svobodová', 'Machová', 'Zelená', 'Yu-Xin', 'Mlsná', 'Dubná',
|
||||
'Mrkvová', 'Suchá', 'Lovelace', 'Holcová', 'Rui']
|
||||
prezdivka = ['Kaki', 'Hurdur', 'Maracuja', 'Bobbo', "", "", "", "", "",
|
||||
prezdivky = ['Kaki', 'Hurdur', 'Maracuja', 'Bobbo', "", "", "", "", "",
|
||||
"", "", 'Riki', 'Sapa', "", '', '---', 'Koko']
|
||||
domain = ['example.com', 'dolujeme.eu', 'mff.cuni.cz', 'strcprstskrzkrk.cz',
|
||||
'british.co.uk', 'splachni.to', 'haha.org']
|
||||
|
@ -42,16 +42,16 @@ def gen_osoby(rnd, size):
|
|||
pohlavi = rnd.randint(0,1)
|
||||
jmeno = rnd.choice([jmena_m, jmena_f][pohlavi])
|
||||
prijmeni = rnd.choice([prijmeni_m, prijmeni_f][pohlavi])
|
||||
prezdivka = rnd.choice([prezdivka])
|
||||
prezdivka = rnd.choice(prezdivky)
|
||||
email = "@".join([unidecode.unidecode(jmeno), rnd.choice(domain)])
|
||||
telefon = [rnd.choice([k for k in range(10)]) for i in range(10)]
|
||||
telefon = "".join([str(rnd.choice([k for k in range(10)])) for i in range(9)])
|
||||
narozeni = datetime.date(rnd.randint(1980, 2020), rnd.randint(1, 12),
|
||||
rnd.randint(1, 28))
|
||||
ulic = rnd.choice(seznam_ulic)
|
||||
cp = rnd.randint(1, 99)
|
||||
ulice = " ".join([ulic, str(cp)])
|
||||
mesto = rnd.choice([seznam_mest])
|
||||
psc = [rnd.choice([k for k in range(10)]) for i in range(6)]
|
||||
mesto = rnd.choice(seznam_mest)
|
||||
psc = "".join([str(rnd.choice([k for k in range(10)])) for i in range(5)])
|
||||
osoby.append(Osoba.objects.create(jmeno = jmeno, prijmeni = prijmeni,
|
||||
prezdivka = prezdivka, pohlavi_muz = pohlavi, email = email,
|
||||
telefon = telefon, datum_narozeni = narozeni, ulice = ulice,
|
||||
|
@ -455,6 +455,19 @@ def gen_ulohy_k_tematum(rnd, rocniky, rocnik_cisla, rocnik_temata, organizatori)
|
|||
|
||||
mozna_tema_vcn = mozna_tema_vcn.succ
|
||||
return
|
||||
|
||||
def gen_novinky(rnd, organizatori):
|
||||
|
||||
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
|
||||
|
||||
def otec_syn(otec, syn):
|
||||
bratr = otec.first_child
|
||||
|
@ -501,6 +514,9 @@ def create_test_data(size = 6, rnd = None):
|
|||
resitele = gen_resitele(rnd, osoby, skoly)
|
||||
organizatori = gen_organizatori(rnd, osoby, last_rocnik, users)
|
||||
|
||||
#generování novinek
|
||||
novinky = gen_novinky(rnd, organizatori)
|
||||
|
||||
# prijemci
|
||||
prijemci = gen_prijemci(rnd, osoby)
|
||||
|
||||
|
@ -539,6 +555,8 @@ def create_test_data(size = 6, rnd = None):
|
|||
# TODO: mezičíslo node
|
||||
# TODO: přidat ke konferám řešení a dát je do čísel
|
||||
|
||||
|
||||
|
||||
# obecné nastavení semináře, musí být už přidané ročníky a čísla, jinak se nastaví divně
|
||||
nastaveni = Nastaveni.objects.create(aktualni_rocnik = Rocnik.objects.last(),
|
||||
aktualni_cislo = Cislo.objects.all()[1])
|
||||
|
|
|
@ -147,7 +147,7 @@ def aktivniOrganizatori(datum=date.today()):
|
|||
return Organizator.objects.exclude(
|
||||
organizuje_do__isnull=False,
|
||||
organizuje_do__lt=datum
|
||||
).order_by('user__first_name')
|
||||
).order_by('osoba__jmeno')
|
||||
|
||||
|
||||
class CojemamOrganizatoriView(generic.ListView):
|
||||
|
@ -593,7 +593,7 @@ def obalkyView(request,resitele):
|
|||
tex = render(request,'seminar/archiv/obalky.tex', {'resitele': resitele}).content
|
||||
|
||||
tempdir = tempfile.mkdtemp()
|
||||
with open(tempdir+"/obalky.tex","w") as texfile:
|
||||
with open(tempdir+"/obalky.tex","wb") as texfile:
|
||||
texfile.write(tex)
|
||||
shutil.copy(os.path.join(settings.STATIC_ROOT, 'seminar/lisak.eps'),tempdir)
|
||||
subprocess.call(["pdflatex","obalky.tex"],cwd = tempdir)
|
||||
|
|
Loading…
Reference in a new issue