From 576d7a3c12390c266a58c0b89a0e6f7a7eed1aa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Koci=C3=A1n?= Date: Tue, 19 Jan 2016 14:28:22 +0100 Subject: [PATCH 1/6] =?UTF-8?q?V=C3=BDsledkovka:=20rozsahy=20bez=20mezer,?= =?UTF-8?q?=20inici=C3=A1ly=20s=20mezerou?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seminar/templates/seminar/archiv/cislo_vysledkovka.tex | 2 +- seminar/views.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/seminar/templates/seminar/archiv/cislo_vysledkovka.tex b/seminar/templates/seminar/archiv/cislo_vysledkovka.tex index 619b30e1..5ad8615a 100644 --- a/seminar/templates/seminar/archiv/cislo_vysledkovka.tex +++ b/seminar/templates/seminar/archiv/cislo_vysledkovka.tex @@ -4,6 +4,6 @@ \endhead \hline \endfoot -{% for rv in vysledkovka %}{{rv.poradi}}&{% if rv.titul %}\titul{ {{ rv.titul}}}{% endif %}{{rv.resitel.inicial_krestni}}{{rv.resitel.prijmeni}}&{{rv.resitel.rocnik|default:""}}&{{rv.body_celkem_odjakziva}}&{% for b in rv.body_ulohy %}{{b}}&{% endfor %}{{rv.body_cislo}}&{{rv.body_celkem_rocnik|default:0}}\\ +{% for rv in vysledkovka %}{{rv.poradi}}&{% if rv.titul %}\titul{ {{ rv.titul}}}{% endif %}{{rv.resitel.inicial_krestni}} {{rv.resitel.prijmeni}}&{{rv.resitel.rocnik|default:""}}&{{rv.body_celkem_odjakziva}}&{% for b in rv.body_ulohy %}{{b}}&{% endfor %}{{rv.body_cislo}}&{{rv.body_celkem_rocnik|default:0}}\\ {% endfor %} \end{longtable} diff --git a/seminar/views.py b/seminar/views.py index cdc5217a..4cd837b2 100644 --- a/seminar/views.py +++ b/seminar/views.py @@ -131,7 +131,7 @@ def sloupec_s_poradim(vysledky): poradi_l += ["{}.".format(lepsich_resitelu + 1)] # je-li účastníků se stejným počtem bodů víc, pořadí (rozsah X.-Y.) je jen u prvního else: - poradi_l += [u"{}. – {}.".format(lepsich_resitelu + 1, lepsich_resitelu + len(skupina))] + [""] * (len(skupina)-1) + poradi_l += [u"{}.–{}.".format(lepsich_resitelu + 1, lepsich_resitelu + len(skupina))] + [""] * (len(skupina)-1) lepsich_resitelu += len(skupina) #pomlcka je opravdu pomlcka v unicode!!dulezite pro vysledkovku v TeXu From f4da10f9fa3af9fcde69c71227d28055f03982ae Mon Sep 17 00:00:00 2001 From: "Bc. Petr Pecha" Date: Fri, 22 Jan 2016 21:42:56 +0100 Subject: [PATCH 2/6] korektury | trizeni souboru od nejmladsiho --- .../0009_trizeni_korektur_v_seznamu.py | 18 ++++++++++++++++++ korektury/models.py | 1 + 2 files changed, 19 insertions(+) create mode 100644 korektury/migrations/0009_trizeni_korektur_v_seznamu.py diff --git a/korektury/migrations/0009_trizeni_korektur_v_seznamu.py b/korektury/migrations/0009_trizeni_korektur_v_seznamu.py new file mode 100644 index 00000000..c4099dce --- /dev/null +++ b/korektury/migrations/0009_trizeni_korektur_v_seznamu.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('korektury', '0008_auto_20151229_1556'), + ] + + operations = [ + migrations.AlterModelOptions( + name='korekturovanepdf', + options={'ordering': ['-cas'], 'verbose_name': 'PDF k oprav\xe1m', 'verbose_name_plural': 'PDF k oprav\xe1m'}, + ), + ] diff --git a/korektury/models.py b/korektury/models.py index 6b598fd1..cccc4a74 100644 --- a/korektury/models.py +++ b/korektury/models.py @@ -23,6 +23,7 @@ def generate_filename(self, filename): #@python_2_unicode_compatible class KorekturovanePDF(models.Model): class Meta: + ordering = ['-cas'] db_table = 'korekturovane_cislo' verbose_name = u'PDF k opravám' verbose_name_plural = u'PDF k opravám' From f091dfb05499cdfbe031c6d5780f115b64a8c754 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Koci=C3=A1n?= Date: Sun, 24 Jan 2016 11:41:25 +0100 Subject: [PATCH 3/6] =?UTF-8?q?CKEditor:=20fix=20nahr=C3=A1v=C3=A1n=C3=AD?= =?UTF-8?q?=20obr=C3=A1zk=C5=AF=20(zm=C4=9Bna=20verze)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mamweb/urls.py | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mamweb/urls.py b/mamweb/urls.py index 5b72ee5b..46e0e292 100644 --- a/mamweb/urls.py +++ b/mamweb/urls.py @@ -10,7 +10,7 @@ urlpatterns = [ # Admin a nastroje url(r'^admin/', include(admin.site.urls)), # NOQA - url(r'^ckeditor/', include('ckeditor_uploader.urls')), + url(r'^ckeditor/', include('ckeditor.urls')), url(r'^autocomplete/', include('autocomplete_light.urls')), # Seminarova aplikace (ma vlastni podadresare) diff --git a/requirements.txt b/requirements.txt index c6401ada..77d913ea 100644 --- a/requirements.txt +++ b/requirements.txt @@ -18,7 +18,7 @@ django-reversion==1.10.0 django-sekizai==0.9.0 django-countries==3.4.1 django-solo==1.1.1 -django-ckeditor==5.0.2 +django-ckeditor<=4.4.5 django-flat-theme==1.1.3 django-taggit==0.17.6 django-autocomplete-light==2.2.10 From 6350f40e31524ebce4280780000bbac55122ffc8 Mon Sep 17 00:00:00 2001 From: "Bc. Petr Pecha" Date: Sun, 24 Jan 2016 22:39:29 +0100 Subject: [PATCH 4/6] tituly | oprava tak, aby lidi bez titulu nemeli MM --- seminar/templates/seminar/archiv/tituly.tex | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/seminar/templates/seminar/archiv/tituly.tex b/seminar/templates/seminar/archiv/tituly.tex index 0720e736..72b1cdde 100644 --- a/seminar/templates/seminar/archiv/tituly.tex +++ b/seminar/templates/seminar/archiv/tituly.tex @@ -7,8 +7,14 @@ {% load tex %} {% for r in resitele %} - {% spaceless %} -\def\{{r.ascii}}{\titul{{r.titul|sloz}}\relax} - {% endspaceless %} + {% if r.titul == '' %} + {% spaceless %} + \def\{{r.ascii}}{} + {% endspaceless %} + {% else %} + {% spaceless %} + \def\{{r.ascii}}{\titul{{r.titul|sloz}}\relax} + {% endspaceless %} + {% endif %} {% endfor %} {% endautoescape %} From 892f6210d1cd5fe782fca67476e1b13f9f5a8b47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Koci=C3=A1n?= Date: Mon, 25 Jan 2016 23:13:40 +0100 Subject: [PATCH 5/6] =?UTF-8?q?Fix:=20url:=20=C4=8D=C3=ADslo=20m=C5=AF?= =?UTF-8?q?=C5=BEe=20obsahovat=20poml=C4=8Dku?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seminar/urls.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/seminar/urls.py b/seminar/urls.py index 59de212b..446d6bc7 100644 --- a/seminar/urls.py +++ b/seminar/urls.py @@ -36,17 +36,17 @@ urlpatterns = [ url(r'^aesop-export/index.csv$', export.ExportIndexView.as_view(), name='seminar_export_index'), #### Stranky viditelne pouze pro orgy: - url(r'^cislo/(?P\d+).(?P\d+)/vysledkovka.tex$', + url(r'^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\d+)/obalky.pdf$', + url(r'^cislo/(?P\d+).(?P[0-9-]+)/obalky.pdf$', staff_member_required(views.cisloObalkyView), name='seminar_cislo_obalky'), - url(r'^cislo/(?P\d+).(?P\d+)/tituly.tex$', + url(r'^cislo/(?P\d+).(?P[0-9-]+)/tituly.tex$', staff_member_required(views.TitulyView), name='seminar_cislo_titul'), - url(r'^stav$', + url(r'^stav$', staff_member_required(views.StavDatabazeView), name='stav_databaze'), - url(r'^cislo/(?P\d+).(?P\d+)/resitel_uloha.html$', - staff_member_required(views.resitelUlohaView),name='seminar_cislo_resitel_uloha'), - url(r'^soustredeni/(?P\d+)/obalky.pdf', - staff_member_required(views.soustredeniObalkyView),name='seminar_soustredeni_obalky'), + url(r'^cislo/(?P\d+).(?P[0-9-]+)/resitel_uloha.html$', + staff_member_required(views.resitelUlohaView), name='seminar_cislo_resitel_uloha'), + url(r'^soustredeni/(?P\d+)/obalky.pdf', + staff_member_required(views.soustredeniObalkyView), name='seminar_soustredeni_obalky'), ] From 16fc060902af47612311574e45bb74bb39df5a04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Koci=C3=A1n?= Date: Tue, 26 Jan 2016 00:24:05 +0100 Subject: [PATCH 6/6] =?UTF-8?q?=C4=8C=C3=ADslo:=20=C3=BAprava=20seznamu=20?= =?UTF-8?q?pro=20ob=C3=A1lkov=C3=A1n=C3=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seminar/templates/seminar/archiv/cislo.html | 19 ++++++----- .../seminar/archiv/cislo_obalkovani.html | 33 +++++++++++++++++++ .../seminar/archiv/resitel_uloha.html | 22 ------------- seminar/urls.py | 4 +-- seminar/views.py | 28 +++++----------- 5 files changed, 53 insertions(+), 53 deletions(-) create mode 100644 seminar/templates/seminar/archiv/cislo_obalkovani.html delete mode 100644 seminar/templates/seminar/archiv/resitel_uloha.html diff --git a/seminar/templates/seminar/archiv/cislo.html b/seminar/templates/seminar/archiv/cislo.html index 56d75675..63038aac 100644 --- a/seminar/templates/seminar/archiv/cislo.html +++ b/seminar/templates/seminar/archiv/cislo.html @@ -28,14 +28,15 @@ {% if user.is_staff %} -
-

Orgovské odkazy

- -
+
+

Orgovské odkazy

+ +
{% endif %} {% if cislo.verejna_vysledkovka %} @@ -61,7 +62,7 @@ {% for rv in vysledkovka %} {% autoescape off %}{{ rv.poradi }}{% endautoescape %} - + {% if rv.titul %} {{ rv.titul }}MM {% endif %} diff --git a/seminar/templates/seminar/archiv/cislo_obalkovani.html b/seminar/templates/seminar/archiv/cislo_obalkovani.html new file mode 100644 index 00000000..dd0b0796 --- /dev/null +++ b/seminar/templates/seminar/archiv/cislo_obalkovani.html @@ -0,0 +1,33 @@ +{% extends "seminar/archiv/base.html" %} + +{% block content %} +

+ {% block nadpis1a %}{% block nadpis1b %} + Obálkování {{ cislo }} + {% endblock %}{% endblock %} +

+ + Obálkovat se budou tyto problémy: +
    + {% for p in problemy %} + +
  • {{ p.kod_v_rocniku }} {{ p }} + {% endfor %} +
+ + {% for r in reseni %} + {% ifchanged r.resitel %} + {% if not forloop.first %} + + {% endif %} +

{{ r.resitel }}

+
    + {% endifchanged %} + +
  • + {{ r.problem.kod_v_rocniku }} {{ r.problem.nazev }} ({{ r.body }}) + + {% endfor %} +
+ +{% endblock content %} diff --git a/seminar/templates/seminar/archiv/resitel_uloha.html b/seminar/templates/seminar/archiv/resitel_uloha.html deleted file mode 100644 index f61ee704..00000000 --- a/seminar/templates/seminar/archiv/resitel_uloha.html +++ /dev/null @@ -1,22 +0,0 @@ - -{% extends "seminar/archiv/base.html" %} - -{% block content %} -

K obálkování

- - -{% for u in ulohy %} - - {% for cell in row%} - - {% endfor %} - -{% endfor %} -
- Jméno{{u.nazev}} -{% endfor %} - -{% for row in kdoco %} -
{{cell}}
-{% endblock content %} - diff --git a/seminar/urls.py b/seminar/urls.py index 446d6bc7..968e5f02 100644 --- a/seminar/urls.py +++ b/seminar/urls.py @@ -45,8 +45,8 @@ urlpatterns = [ staff_member_required(views.TitulyView), name='seminar_cislo_titul'), url(r'^stav$', staff_member_required(views.StavDatabazeView), name='stav_databaze'), - url(r'^cislo/(?P\d+).(?P[0-9-]+)/resitel_uloha.html$', - staff_member_required(views.resitelUlohaView), name='seminar_cislo_resitel_uloha'), + url(r'^cislo/(?P\d+).(?P[0-9-]+)/obalkovani$', + staff_member_required(views.obalkovaniView), name='seminar_cislo_resitel_obalkovani'), url(r'^soustredeni/(?P\d+)/obalky.pdf', staff_member_required(views.soustredeniObalkyView), name='seminar_soustredeni_obalky'), ] diff --git a/seminar/views.py b/seminar/views.py index 4cd837b2..0f4c6e50 100644 --- a/seminar/views.py +++ b/seminar/views.py @@ -404,27 +404,15 @@ def obalkyView(request,resitele): shutil.rmtree(tempdir) return response -def resitelUlohaView(request,rocnik,cislo): +def obalkovaniView(request, rocnik, cislo): rocnik = Rocnik.objects.get(rocnik=rocnik) - cislo = Cislo.objects.get(rocnik=rocnik,cislo=cislo) - reseni = Reseni.objects.filter(cislo_body=cislo).order_by('resitel') - # TODO: Nasledujici 4 radky jsou fuj. Znate neco lepsiho? - resitele = list(set([r.resitel for r in reseni])) - resitele.sort(key=lambda r: (r.prijmeni,r.jmeno)) - ulohy = list(set([r.problem for r in reseni])) - ulohy.sort(key=lambda u: (u.typ,u.kod)) - - kdoco = [] - for r in resitele: - res_ulohy = [r.jmeno+" "+r.prijmeni] - for u in ulohy: - try: - rsni = reseni.get(resitel=r,problem=u) - res_ulohy.append(rsni.body) - except ObjectDoesNotExist: - res_ulohy.append("") - kdoco.append(res_ulohy) - return render(request, 'seminar/archiv/resitel_uloha.html',{'ulohy':ulohy,'kdoco':kdoco}) + cislo = Cislo.objects.get(rocnik=rocnik, cislo=cislo) + + reseni = Reseni.objects.filter(cislo_body=cislo) + serazena_reseni = sorted(reseni, key=lambda r: (r.resitel.prijmeni, r.resitel.jmeno, r.problem.typ, r.problem.kod)) + + problemy = sorted(set(r.problem for r in reseni), key=lambda p: (p.typ, p.kod)) + return render(request, 'seminar/archiv/cislo_obalkovani.html', {'cislo': cislo, 'problemy': problemy, 'reseni': serazena_reseni}) ### Tituly