diff --git a/mamweb/static/css/mamweb.css b/mamweb/static/css/mamweb.css index dc942cc2..a9621bc5 100644 --- a/mamweb/static/css/mamweb.css +++ b/mamweb/static/css/mamweb.css @@ -7,6 +7,7 @@ font-weight: normal; body { font-family: 'OpenSans'; background-color: #fffbf6; + min-height: 100%; } div.container { @@ -296,7 +297,7 @@ ul.submenu { ul.submenu { background-color: #e84e10; - z-index: 5; + z-index: 50; font-weight: 400; } @@ -439,6 +440,10 @@ ul.submenu { ul.submenu { margin-top: 8px; /* mezera mezi hlavním menu a submenu */ } + + a.ref-org-foto { + pointer-events: none; + } } /* malý tablet, mobil */ @@ -564,6 +569,7 @@ ul.submenu { display: block; } + /*patička mobil*/ #footer { @@ -947,3 +953,39 @@ p.gdpr { div.gdpr { font-size: 6pt; } + +/* přihláška a další formuláře */ + +table.form td, table.form tr { + table-layout: fixed; + word-wrap: break-word; + padding: 5px; +} + +.field-with-comment{ + position:relative; +} + +.field-comment{ + display:none; + text-shadow: 0 1px 0 #fff; + background-color: #f0f0f0 ; + border-color: #dbdbdb; + position:absolute; + z-index:100; + border:1px; + border-style:solid; + border-width:1px; + border-radius: 5px; + padding:3px; + top:20px; + left:20px; +} + +.field-with-comment:hover span.field-comment{ + display:block; +} + +input { + margin: 5px; +} diff --git a/seminar/tests.py b/seminar/old_tests.py similarity index 100% rename from seminar/tests.py rename to seminar/old_tests.py diff --git a/seminar/templates/seminar/cojemam/organizatori.html b/seminar/templates/seminar/cojemam/organizatori.html index a3957101..5b147aa5 100644 --- a/seminar/templates/seminar/cojemam/organizatori.html +++ b/seminar/templates/seminar/cojemam/organizatori.html @@ -53,7 +53,7 @@
{% if org.osoba.foto %} - {{org.osoba.jmeno}} {{org.osoba.prijmeni}} + {{org.osoba.jmeno}} {{org.osoba.prijmeni}} {% else %} {# pokud osoba nemá fotku, zobrazuje se defaultní obrázek #} {% load static %} {{org.osoba.jmeno}} {{org.osoba.prijmeni}} {% endif %} diff --git a/seminar/templates/seminar/login.html b/seminar/templates/seminar/login.html index 9769a41a..0263b9a6 100644 --- a/seminar/templates/seminar/login.html +++ b/seminar/templates/seminar/login.html @@ -18,8 +18,18 @@ -Zapomněl jsem heslo
-Zaregistrovat
+
+ +
+ +
+

+ Ješte nejste zaregistrováni? +

+ +
+ +
{% endblock %} diff --git a/seminar/templates/seminar/nahraj_reseni.html b/seminar/templates/seminar/nahraj_reseni.html index 7e3d1e72..d95f8567 100644 --- a/seminar/templates/seminar/nahraj_reseni.html +++ b/seminar/templates/seminar/nahraj_reseni.html @@ -14,31 +14,39 @@
{% csrf_token %} -{{form}} -{{prilohy.management_form}} +{{ form }} +{{ prilohy.management_form }} + + +

Přilohy s řešením

+
{% for form in prilohy.forms %}
- {{form.non_field_errors}} - {{form.errors}} + {{ form.non_field_errors }} + {{ form.errors }} {{ form }}
- +
{% endfor %}
+ + - + +
+

Odevzdat má řešení

+
{% endblock %} diff --git a/seminar/templates/seminar/prihlaska_field.html b/seminar/templates/seminar/prihlaska_field.html index 04ecf145..8344a683 100644 --- a/seminar/templates/seminar/prihlaska_field.html +++ b/seminar/templates/seminar/prihlaska_field.html @@ -4,17 +4,14 @@ + - + {{ field }} + {{ field.help_text|safe }} -{% if field.help_text %} - - {{ field.help_text|safe }} - -{% endif %} {% if field.errors %} diff --git a/seminar/tests_treelib.py b/seminar/tests_treelib.py new file mode 100644 index 00000000..3245d0a6 --- /dev/null +++ b/seminar/tests_treelib.py @@ -0,0 +1,40 @@ +from django.test import TestCase +import seminar.treelib as tl +import seminar.models as m + +class SimpleTreeLibTests(TestCase): + def setUp(self): + # Vyrobíme pár nějakých Nodů + self.root = m.CastNode(root=None, first_child=None, succ=None, nadpis="Root") + self.root.save() + self.some_node = m.CastNode(root=self.root, first_child=None, succ=None, nadpis="Přetržené") + self.other_node = m.CastNode(root=self.root, first_child=None, succ=None, nadpis="Dítě") + self.some_orphan = m.CastNode(root=None, first_child=None, succ=None, nadpis="Ošklivé") + self.other_orphan = m.CastNode(root=None, first_child=None, succ=None, nadpis="Káčátko") + + # Trochu je pospojujeme + self.root.first_child = self.some_node + self.some_node.succ = self.other_node + self.some_orphan.first_child = self.other_orphan + + # Všechno uložíme + self.other_node.save() + self.some_node.save() + self.other_orphan.save() + self.some_orphan.save() + self.root.save() + + def test_safe_functions(self): + # safe_pred + self.assertEqual(tl.safe_pred(self.other_node), self.some_node) + self.assertIsNone(tl.safe_pred(self.root)) + self.assertIsNone(tl.safe_pred(self.some_node)) + self.assertIsNone(tl.safe_pred(self.some_orphan)) + self.assertIsNone(tl.safe_pred(self.other_orphan)) + + # safe_father_of_first + self.assertIsNone(tl.safe_father_of_first(self.root)) + self.assertEqual(tl.safe_father_of_first(self.some_node), self.root) + self.assertEqual(tl.safe_father_of_first(self.other_node), self.root) + self.assertIsNone(tl.safe_father_of_first(self.some_orphan)) + self.assertEqual(tl.safe_father_of_first(self.other_orphan), self.some_orphan) diff --git a/seminar/testutils.py b/seminar/testutils.py index 18319546..3c4356a2 100644 --- a/seminar/testutils.py +++ b/seminar/testutils.py @@ -78,7 +78,7 @@ def gen_osoby(rnd, size): rnd.randint(1, 28)) ulic = rnd.choice(seznam_ulic) cp = rnd.randint(1, 99) - ulice = "".join([ulic, str(cp)]) + ulice = " ".join([ulic, str(cp)]) mesto = rnd.choice(seznam_mest) psc = "".join([str(rnd.choice([k for k in range(10)])) for i in range(5)]) diff --git a/seminar/views/unicodecsv.py b/seminar/views/unicodecsv.py deleted file mode 100644 index 4c38f6b5..00000000 --- a/seminar/views/unicodecsv.py +++ /dev/null @@ -1,62 +0,0 @@ -import csv, codecs -from io import StringIO - -class UTF8Recoder: - """ - Iterator that reads an encoded stream and reencodes the input to UTF-8 - """ - def __init__(self, f, encoding): - self.reader = codecs.getreader(encoding)(f) - - def __iter__(self): - return self - - def next(self): - return self.reader.next().encode("utf-8") - -class UnicodeReader: - """ - A CSV reader which will iterate over lines in the CSV file "f", - which is encoded in the given encoding. - """ - - def __init__(self, f, dialect=csv.excel, encoding="utf-8", **kwds): - f = UTF8Recoder(f, encoding) - self.reader = csv.reader(f, dialect=dialect, **kwds) - - def next(self): - row = self.reader.next() - return [unicode(s, "utf-8") for s in row] - - def __iter__(self): - return self - -class UnicodeWriter: - """ - A CSV writer which will write rows to CSV file "f", - which is encoded in the given encoding. - """ - - def __init__(self, f, dialect=csv.excel, encoding="utf-8", **kwds): - # Redirect output to a queue - self.queue = cStringIO.StringIO() - self.writer = csv.writer(self.queue, dialect=dialect, **kwds) - self.stream = f - self.encoder = codecs.getincrementalencoder(encoding)() - - def writerow(self, row): - self.writer.writerow([s.encode("utf-8") for s in row]) - # Fetch UTF-8 output from the queue ... - data = self.queue.getvalue() - data = data.decode("utf-8") - # ... and reencode it into the target encoding - data = self.encoder.encode(data) - # write to the target stream - self.stream.write(data) - # empty queue - self.queue.truncate(0) - - def writerows(self, rows): - for row in rows: - self.writerow(row) - diff --git a/seminar/views/views_all.py b/seminar/views/views_all.py index aa34837f..a0bcfb5f 100644 --- a/seminar/views/views_all.py +++ b/seminar/views/views_all.py @@ -21,7 +21,6 @@ import seminar.models as m from seminar.models import Problem, Cislo, Reseni, Nastaveni, Rocnik, Soustredeni, Organizator, Resitel, Novinky, Soustredeni_Ucastnici, Pohadka, Tema, Clanek, Osoba, Skola # Tohle je stare a chceme se toho zbavit. Pouzivejte s.ToCoChci #from .models import VysledkyZaCislo, VysledkyKCisluZaRocnik, VysledkyKCisluOdjakziva from seminar import utils, treelib -from .unicodecsv import UnicodeWriter from seminar.forms import PrihlaskaForm, LoginForm, ProfileEditForm import seminar.forms as f @@ -1056,10 +1055,11 @@ def soustredeniUcastniciExportView(request,soustredeni): response = HttpResponse(content_type='text/csv') response['Content-Disposition'] = 'attachment; filename="ucastnici.csv"' - writer = UnicodeWriter(response) + writer = csv.writer(response) writer.writerow(["jmeno", "prijmeni", "rok_maturity", "telefon", "email", "ulice", "mesto", "psc","stat"]) for u in ucastnici: - writer.writerow([u.jmeno, u.prijmeni, str(u.rok_maturity), u.telefon, u.email, u.ulice, u.mesto, u.psc, u.stat.name]) + o = u.osoba + writer.writerow([o.jmeno, o.prijmeni, str(u.rok_maturity), o.telefon, o.email, o.ulice, o.mesto, o.psc, o.stat.name]) return response