Browse Source

Merge branch 'master' into stable

remotes/origin/temata
Bc. Petr Pecha 9 years ago
parent
commit
ce41953aea
  1. 18
      korektury/migrations/0009_trizeni_korektur_v_seznamu.py
  2. 1
      korektury/models.py
  3. 2
      mamweb/urls.py
  4. 2
      requirements.txt
  5. 1
      seminar/templates/seminar/archiv/cislo.html
  6. 33
      seminar/templates/seminar/archiv/cislo_obalkovani.html
  7. 22
      seminar/templates/seminar/archiv/resitel_uloha.html
  8. 6
      seminar/templates/seminar/archiv/tituly.tex
  9. 10
      seminar/urls.py
  10. 26
      seminar/views.py

18
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'},
),
]

1
korektury/models.py

@ -23,6 +23,7 @@ def generate_filename(self, filename):
#@python_2_unicode_compatible #@python_2_unicode_compatible
class KorekturovanePDF(models.Model): class KorekturovanePDF(models.Model):
class Meta: class Meta:
ordering = ['-cas']
db_table = 'korekturovane_cislo' db_table = 'korekturovane_cislo'
verbose_name = u'PDF k opravám' verbose_name = u'PDF k opravám'
verbose_name_plural = u'PDF k opravám' verbose_name_plural = u'PDF k opravám'

2
mamweb/urls.py

@ -10,7 +10,7 @@ urlpatterns = [
# Admin a nastroje # Admin a nastroje
url(r'^admin/', include(admin.site.urls)), # NOQA 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')), url(r'^autocomplete/', include('autocomplete_light.urls')),
# Seminarova aplikace (ma vlastni podadresare) # Seminarova aplikace (ma vlastni podadresare)

2
requirements.txt

@ -18,7 +18,7 @@ django-reversion==1.10.0
django-sekizai==0.9.0 django-sekizai==0.9.0
django-countries==3.4.1 django-countries==3.4.1
django-solo==1.1.1 django-solo==1.1.1
django-ckeditor==5.0.2 django-ckeditor<=4.4.5
django-flat-theme==1.1.3 django-flat-theme==1.1.3
django-taggit==0.17.6 django-taggit==0.17.6
django-autocomplete-light==2.2.10 django-autocomplete-light==2.2.10

1
seminar/templates/seminar/archiv/cislo.html

@ -34,6 +34,7 @@
<li><a href="obalky.pdf">Obálky (PDF)</a></li> <li><a href="obalky.pdf">Obálky (PDF)</a></li>
<li><a href="tituly.tex">Tituly (TeX)</a></li> <li><a href="tituly.tex">Tituly (TeX)</a></li>
<li><a href="vysledkovka.tex">Výsledkovka (TeX)</a></li> <li><a href="vysledkovka.tex">Výsledkovka (TeX)</a></li>
<li><a href="obalkovani">Obálkování</a></li>
</ul> </ul>
</div> </div>
{% endif %} {% endif %}

33
seminar/templates/seminar/archiv/cislo_obalkovani.html

@ -0,0 +1,33 @@
{% extends "seminar/archiv/base.html" %}
{% block content %}
<h1>
{% block nadpis1a %}{% block nadpis1b %}
Obálkování {{ cislo }}
{% endblock %}{% endblock %}
</h1>
Obálkovat se budou tyto problémy:
<ul>
{% for p in problemy %}
<li> {{ p.kod_v_rocniku }} {{ p }}
{% endfor %}
</ul>
{% for r in reseni %}
{% ifchanged r.resitel %}
{% if not forloop.first %}
</ul>
{% endif %}
<h4>{{ r.resitel }}</h4>
<ul>
{% endifchanged %}
<li>
{{ r.problem.kod_v_rocniku }} {{ r.problem.nazev }} ({{ r.body }})
{% endfor %}
</ul>
{% endblock content %}

22
seminar/templates/seminar/archiv/resitel_uloha.html

@ -1,22 +0,0 @@
{% extends "seminar/archiv/base.html" %}
{% block content %}
<h1> K obálkování </h1>
<table>
<th>
<td>Jméno</td>
{% for u in ulohy %}
<td>{{u.nazev}}
{% endfor %}
</th>
{% for row in kdoco %}
<tr>
{% for cell in row%}
<td>{{cell}}</td>
{% endfor %}
</tr>
{% endfor %}
</table>
{% endblock content %}

6
seminar/templates/seminar/archiv/tituly.tex

@ -7,8 +7,14 @@
{% load tex %} {% load tex %}
{% for r in resitele %} {% for r in resitele %}
{% if r.titul == '' %}
{% spaceless %}
\def\{{r.ascii}}{}
{% endspaceless %}
{% else %}
{% spaceless %} {% spaceless %}
\def\{{r.ascii}}{\titul{{r.titul|sloz}}\relax} \def\{{r.ascii}}{\titul{{r.titul|sloz}}\relax}
{% endspaceless %} {% endspaceless %}
{% endif %}
{% endfor %} {% endfor %}
{% endautoescape %} {% endautoescape %}

10
seminar/urls.py

@ -36,17 +36,17 @@ urlpatterns = [
url(r'^aesop-export/index.csv$', export.ExportIndexView.as_view(), name='seminar_export_index'), url(r'^aesop-export/index.csv$', export.ExportIndexView.as_view(), name='seminar_export_index'),
#### Stranky viditelne pouze pro orgy: #### Stranky viditelne pouze pro orgy:
url(r'^cislo/(?P<rocnik>\d+).(?P<cislo>\d+)/vysledkovka.tex$', url(r'^cislo/(?P<rocnik>\d+).(?P<cislo>[0-9-]+)/vysledkovka.tex$',
staff_member_required(views.CisloVysledkovkaView.as_view()), name='seminar_cislo_vysledkovka'), staff_member_required(views.CisloVysledkovkaView.as_view()), name='seminar_cislo_vysledkovka'),
url(r'^cislo/(?P<rocnik>\d+).(?P<cislo>\d+)/obalky.pdf$', url(r'^cislo/(?P<rocnik>\d+).(?P<cislo>[0-9-]+)/obalky.pdf$',
staff_member_required(views.cisloObalkyView), name='seminar_cislo_obalky'), staff_member_required(views.cisloObalkyView), name='seminar_cislo_obalky'),
url(r'^cislo/(?P<rocnik>\d+).(?P<cislo>\d+)/tituly.tex$', url(r'^cislo/(?P<rocnik>\d+).(?P<cislo>[0-9-]+)/tituly.tex$',
staff_member_required(views.TitulyView), name='seminar_cislo_titul'), staff_member_required(views.TitulyView), name='seminar_cislo_titul'),
url(r'^stav$', url(r'^stav$',
staff_member_required(views.StavDatabazeView), name='stav_databaze'), staff_member_required(views.StavDatabazeView), name='stav_databaze'),
url(r'^cislo/(?P<rocnik>\d+).(?P<cislo>\d+)/resitel_uloha.html$', url(r'^cislo/(?P<rocnik>\d+).(?P<cislo>[0-9-]+)/obalkovani$',
staff_member_required(views.resitelUlohaView),name='seminar_cislo_resitel_uloha'), staff_member_required(views.obalkovaniView), name='seminar_cislo_resitel_obalkovani'),
url(r'^soustredeni/(?P<soustredeni>\d+)/obalky.pdf', url(r'^soustredeni/(?P<soustredeni>\d+)/obalky.pdf',
staff_member_required(views.soustredeniObalkyView), name='seminar_soustredeni_obalky'), staff_member_required(views.soustredeniObalkyView), name='seminar_soustredeni_obalky'),
] ]

26
seminar/views.py

@ -404,27 +404,15 @@ def obalkyView(request,resitele):
shutil.rmtree(tempdir) shutil.rmtree(tempdir)
return response return response
def resitelUlohaView(request,rocnik,cislo): def obalkovaniView(request, rocnik, cislo):
rocnik = Rocnik.objects.get(rocnik=rocnik) rocnik = Rocnik.objects.get(rocnik=rocnik)
cislo = Cislo.objects.get(rocnik=rocnik, cislo=cislo) 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? reseni = Reseni.objects.filter(cislo_body=cislo)
resitele = list(set([r.resitel for r in reseni])) serazena_reseni = sorted(reseni, key=lambda r: (r.resitel.prijmeni, r.resitel.jmeno, r.problem.typ, r.problem.kod))
resitele.sort(key=lambda r: (r.prijmeni,r.jmeno))
ulohy = list(set([r.problem for r in reseni])) problemy = sorted(set(r.problem for r in reseni), key=lambda p: (p.typ, p.kod))
ulohy.sort(key=lambda u: (u.typ,u.kod)) return render(request, 'seminar/archiv/cislo_obalkovani.html', {'cislo': cislo, 'problemy': problemy, 'reseni': serazena_reseni})
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})
### Tituly ### Tituly

Loading…
Cancel
Save