Browse Source

Merge branch 'test'

middleware_test v1.10
LEdoian 6 years ago
parent
commit
743d8056da
  1. 3
      .gitignore
  2. 9
      Makefile
  3. 22
      korektury/templates/korektury/opraf.html
  4. 2
      korektury/templates/korektury/seznam.html
  5. 4
      mamweb/admin.py
  6. 1
      mamweb/settings_common.py
  7. 9
      mamweb/settings_local.py
  8. 2
      mamweb/settings_prod.py
  9. 7
      mamweb/settings_test.py
  10. 16
      seminar/admin.py
  11. 2
      seminar/templates/seminar/archiv/cislo_vysledkovka.tex
  12. 138
      seminar/templates/seminar/archiv/obalky.tex
  13. 17
      seminar/views.py

3
.gitignore

@ -27,3 +27,6 @@
# org poznamky # org poznamky
schemata schemata
TODO TODO
# .htpasswd kvůli přihlášení
.htpasswd

9
Makefile

@ -119,12 +119,13 @@ sync_test: sync_test_media sync_test_db
# Does not sync Galerie and CACHE (too huge). # Does not sync Galerie and CACHE (too huge).
sync_local_media: sync_local_media:
rsync -ave ssh --exclude Galerie --exclude CACHE\ rsync -ave ssh --exclude Galerie --exclude CACHE\
www-mam@atrey.karlin.mff.cuni.cz:/akce/MaM/WWW/mamweb-prod/media/ ./media/ mam-web@gimli.ms.mff.cuni.cz:/akce/mam/www/mamweb-prod/media/ ./media/
# Downloads and restores production database to local database. PostgreSQL only. # Downloads and restores production database to local database. PostgreSQL only.
sync_local_db: sync_local_db:
scp www-mam@atrey.karlin.mff.cuni.cz:`ssh www-mam@atrey.karlin.mff.cuni.cz 'ls -v /akce/MaM/WWW/backups/mam-prod-*\.pgdump | tail -n 1'` \ scp mam-web@gimli.ms.mff.cuni.cz:`ssh mam-web@gimli.ms.mff.cuni.cz 'ls -v /akce/mam/www/backups/mam_prod-*\.pgdump.xz | tail -n 1'` \
./last.pgdump ./last.pgdump.xz
pg_restore -c -d mam_prod last.pgdump xz -fd last.pgdump.xz
pg_restore -c -d mam-prod last.pgdump
# Sync database and media. See above lines # Sync database and media. See above lines
sync_local: sync_media sync_db sync_local: sync_media sync_db

22
korektury/templates/korektury/opraf.html

@ -7,10 +7,10 @@
<script src="{% static "korektury/opraf.js"%}"></script> <script src="{% static "korektury/opraf.js"%}"></script>
<title>Korektury {{pdf.nazev}}</title> <title>Korektury {{pdf.nazev}}</title>
</head> </head>
<body {% if pdf.status = 'zanaseni'%} class="comitting" {% elif pdf.status = 'zastarale' %} class="deprecated" {% endif %} onload='place_comments()'> <body {% if pdf.status == 'zanaseni'%} class="comitting" {% elif pdf.status == 'zastarale' %} class="deprecated" {% endif %} onload='place_comments()'>
<h1>Korektury {{pdf.nazev}}</h1> <h1>Korektury {{pdf.nazev}}</h1>
{% if pdf.status = 'zanaseni' %} <h2> Probíhá zanášení korektur, zvažte, zda chcete přidávat nové </h2> {% endif %} {% if pdf.status == 'zanaseni' %} <h2> Probíhá zanášení korektur, zvažte, zda chcete přidávat nové </h2> {% endif %}
{% if pdf.status = 'zastarale' %} <h2> Toto PDF je již zastaralé, nepřidávejte nové korektury </h2> {% endif %} {% if pdf.status == 'zastarale' %} <h2> Toto PDF je již zastaralé, nepřidávejte nové korektury </h2> {% endif %}
<i>{{pdf.komentar}}</i> <i>{{pdf.komentar}}</i>
<br> <br>
<i>Klikni na chybu, napiš komentář</i> | <i>Klikni na chybu, napiš komentář</i> |
@ -60,11 +60,11 @@
{% csrf_token %} {% csrf_token %}
<input type='hidden' name='action' value='set-state'/> <input type='hidden' name='action' value='set-state'/>
<input type='hidden' name='pdf' value='{{pdf.id}}'/> <input type='hidden' name='pdf' value='{{pdf.id}}'/>
<input type="radio" name="state" value="adding" {% if pdf.status = 'pridavani' %} checked {% endif %}>Přidávání korektur <input type="radio" name="state" value="adding" {% if pdf.status == 'pridavani' %} checked {% endif %}>Přidávání korektur
<br> <br>
<input type="radio" name="state" value="comitting" {% if pdf.status = 'zanaseni' %} checked {% endif %}>Zanášení korektur <input type="radio" name="state" value="comitting" {% if pdf.status == 'zanaseni' %} checked {% endif %}>Zanášení korektur
<br> <br>
<input type="radio" name="state" value="deprecated" {% if pdf.status = 'zastarale' %} checked {% endif %}>Zastaralé, nekorigovat <input type="radio" name="state" value="deprecated" {% if pdf.status == 'zastarale' %} checked {% endif %}>Zastaralé, nekorigovat
<br> <br>
<input type='submit' value='Změnit stav PDF'/> <input type='submit' value='Změnit stav PDF'/>
</form> </form>
@ -81,12 +81,12 @@
{% for o in opravy %} {% for o in opravy %}
<div onclick='img_click(this,event)' <div onclick='img_click(this,event)'
id='op{{o.id}}-pointer' id='op{{o.id}}-pointer'
class='pointer{%if o.status = 'opraveno' %}-done{% elif o.status = 'neni_chyba' %}-wontfix{% elif o.status = 'k_zaneseni' %}-ready{% endif %}'> class='pointer{%if o.status == 'opraveno' %}-done{% elif o.status == 'neni_chyba' %}-wontfix{% elif o.status == 'k_zaneseni' %}-ready{% endif %}'>
</div> </div>
<div name='op{{o.id}}' id='op{{o.id}}' <div name='op{{o.id}}' id='op{{o.id}}'
class='box{%if o.status = 'opraveno' %}-done{% elif o.status = 'neni_chyba' %}-wontfix{% elif o.status = 'k_zaneseni' %}-ready{% endif %}' class='box{%if o.status == 'opraveno' %}-done{% elif o.status == 'neni_chyba' %}-wontfix{% elif o.status == 'k_zaneseni' %}-ready{% endif %}'
onmouseover='box_onmouseover(this,{% if o.status = 'opraveno' %}"done"{% elif o.status = 'neni_chyba' %}"wontfix"{% elif o.status = 'k_zaneseni' %}"ready"{% else %}""{% endif %})' onmouseover='box_onmouseover(this,{% if o.status == 'opraveno' %}"done"{% elif o.status == 'neni_chyba' %}"wontfix"{% elif o.status == 'k_zaneseni' %}"ready"{% else %}""{% endif %})'
onmouseout='box_onmouseout(this, {% if o.status = 'opraveno' %}"done"{% elif o.status = 'neni_chyba' %}"wontfix"{% elif o.status = 'k_zaneseni' %}"ready"{% else %}""{% endif %})'> onmouseout='box_onmouseout(this, {% if o.status == 'opraveno' %}"done"{% elif o.status == 'neni_chyba' %}"wontfix"{% elif o.status == 'k_zaneseni' %}"ready"{% else %}""{% endif %})'>
<div class='corr-header'> <div class='corr-header'>
<span class='author' id='op{{o.id}}-autor'>{{o.autor}}</span> <span class='author' id='op{{o.id}}-autor'>{{o.autor}}</span>
@ -142,7 +142,7 @@
<img src="{% static "korektury/imgs/edit.png" %}"/> <img src="{% static "korektury/imgs/edit.png" %}"/>
</button> </button>
{% endif %} {% endif %}
{% if o.status = 'opraveno' or o.status = 'neni_chyba' %} {% if o.status == 'opraveno' or o.status == 'neni_chyba' %}
<button type='button' title='Korekturu nelze komentovat, protože už je uzavřená'> <button type='button' title='Korekturu nelze komentovat, protože už je uzavřená'>
<img src="{% static "korektury/imgs/comment-gr.png" %}"/> <img src="{% static "korektury/imgs/comment-gr.png" %}"/>
</button> </button>

2
korektury/templates/korektury/seznam.html

@ -17,7 +17,7 @@
<ul> <ul>
{% for pdf in object_list %} {% for pdf in object_list %}
<li><span {% if pdf.status = 'zanaseni'%} class="comitting-text" {% elif pdf.status = 'zastarale' %} class="deprecated-text" {% endif %}> <b>{{ pdf.nazev }}</b> <i>{{pdf.komentar}}</i> <a href="/korektury/{{pdf.id}}">{{pdf.pdf.name}}</a> </span> </li> <li><span {% if pdf.status == 'zanaseni'%} class="comitting-text" {% elif pdf.status == 'zastarale' %} class="deprecated-text" {% endif %}> <b>{{ pdf.nazev }}</b> <i>{{pdf.komentar}}</i> <a href="/korektury/{{pdf.id}}">{{pdf.pdf.name}}</a> </span> </li>
{% empty %} {% empty %}
<li> Nejsou žádné dokumenty ke korekturování. <li> Nejsou žádné dokumenty ke korekturování.
{% endfor %} {% endfor %}

4
mamweb/admin.py

@ -6,10 +6,10 @@ from django.contrib.flatpages.admin import FlatPageAdmin as FlatPageAdminOld
from django.contrib.flatpages.admin import FlatpageForm as FlatpageFormOld from django.contrib.flatpages.admin import FlatpageForm as FlatpageFormOld
from django import forms from django import forms
from ckeditor.widgets import CKEditorWidget from ckeditor_uploader.widgets import CKEditorUploadingWidget
class FlatpageForm(FlatpageFormOld): class FlatpageForm(FlatpageFormOld):
content = forms.CharField(widget=CKEditorWidget()) content = forms.CharField(widget=CKEditorUploadingWidget())
class Meta: class Meta:
model = FlatPage # this is not automatically inherited from FlatpageFormOld model = FlatPage # this is not automatically inherited from FlatpageFormOld
exclude = [] exclude = []

1
mamweb/settings_common.py

@ -100,6 +100,7 @@ INSTALLED_APPS = (
'django_countries', 'django_countries',
'solo', 'solo',
'ckeditor', 'ckeditor',
'ckeditor_uploader',
'taggit', 'taggit',
'autocomplete_light', 'autocomplete_light',

9
mamweb/settings_local.py

@ -10,6 +10,9 @@ import os.path
# Import common settings # Import common settings
from .settings_common import * from .settings_common import *
MIDDLEWARE_CLASSES += (
'debug_toolbar.middleware.DebugToolbarMiddleware',
)
# Quick-start development settings - unsuitable for production # Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/ # See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
@ -22,7 +25,7 @@ INSTALLED_APPS += (
# SECURITY WARNING: don't run with debug turned on in production! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True DEBUG = True
TEMPLATE_DEBUG = True TEMPLATES[0]['OPTIONS']['debug'] = True
ALLOWED_HOSTS = ['127.0.0.1'] ALLOWED_HOSTS = ['127.0.0.1']
@ -48,7 +51,3 @@ DATABASES = {
# set to 'DEBUG' for EXTRA verbose output # set to 'DEBUG' for EXTRA verbose output
LOGGING['handlers']['console']['level'] = 'INFO' LOGGING['handlers']['console']['level'] = 'INFO'
# So that it is not necessary to restart the server every time a template is
# changed
TEMPLATE_LOADERS = ('django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader')

2
mamweb/settings_prod.py

@ -50,7 +50,7 @@ SERVER_EMAIL = 'mamweb-prod-errors@mam.mff.cuni.cz'
ADMINS = [ ADMINS = [
('Tomas Gavenciak', 'gavento@gmail.com'), ('Tomas Gavenciak', 'gavento@gmail.com'),
('Matěj Kocián', 'matej.kocian@gmail.com'), ('Matěj Kocián', 'matej.kocian@gmail.com'),
('M&M ERRORs', 'mam-errors@atrey.karlin.mff.cuni.cz'), ('M&M ERRORs', 'mam-errors@mam.mff.cuni.cz'),
] ]

7
mamweb/settings_test.py

@ -12,6 +12,9 @@ import os.path
# Import common settings # Import common settings
from .settings_common import * # zatim nutne, casem snad vyresime # noqa from .settings_common import * # zatim nutne, casem snad vyresime # noqa
MIDDLEWARE_CLASSES += (
'debug_toolbar.middleware.DebugToolbarMiddleware',
)
# Quick-start development settings - unsuitable for production # Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/ # See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
@ -27,7 +30,7 @@ SECRET_KEY = ')^u=i65*zmr_k53a*@f4q_+ji^o@!pgpef*5&8c7zzv9l+zo)n'
# SECURITY WARNING: don't run with debug turned on in production! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True DEBUG = True
TEMPLATE_DEBUG = False TEMPLATES[0]['OPTIONS']['debug'] = True
ALLOWED_HOSTS = ['*.mam.mff.cuni.cz', 'atrey.karlin.mff.cuni.cz', 'mam.mff.cuni.cz', 'mam-test.kam.mff.cuni.cz', 'gimli.ms.mff.cuni.cz'] ALLOWED_HOSTS = ['*.mam.mff.cuni.cz', 'atrey.karlin.mff.cuni.cz', 'mam.mff.cuni.cz', 'mam-test.kam.mff.cuni.cz', 'gimli.ms.mff.cuni.cz']
@ -49,7 +52,7 @@ import os
SERVER_EMAIL = 'mamweb-test-errors@mam.mff.cuni.cz' SERVER_EMAIL = 'mamweb-test-errors@mam.mff.cuni.cz'
ADMINS = [ ADMINS = [
('M&M ERRORs', 'mam-errors@atrey.karlin.mff.cuni.cz'), ('M&M ERRORs', 'mam-errors@mam.mff.cuni.cz'),
] ]

16
seminar/admin.py

@ -5,7 +5,7 @@ from django import forms
from django.forms import widgets from django.forms import widgets
from reversion.admin import VersionAdmin from reversion.admin import VersionAdmin
from solo.admin import SingletonModelAdmin from solo.admin import SingletonModelAdmin
from ckeditor.widgets import CKEditorWidget from ckeditor_uploader.widgets import CKEditorUploadingWidget
from django.db.models import Count from django.db.models import Count
from django.db import models from django.db import models
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
@ -402,9 +402,9 @@ from autocomplete_light.contrib.taggit_field import TaggitField, TaggitWidget
class ProblemAdminForm(forms.ModelForm): class ProblemAdminForm(forms.ModelForm):
text_zadani = forms.CharField(widget=CKEditorWidget(), required=False, **field_labels(Problem, 'text_zadani')) text_zadani = forms.CharField(widget=CKEditorUploadingWidget(), required=False, **field_labels(Problem, 'text_zadani'))
text_reseni = forms.CharField(widget=CKEditorWidget(), required=False, **field_labels(Problem, 'text_reseni')) text_reseni = forms.CharField(widget=CKEditorUploadingWidget(), required=False, **field_labels(Problem, 'text_reseni'))
text_org = forms.CharField(widget=CKEditorWidget(), required=False, **field_labels(Problem, 'text_org')) text_org = forms.CharField(widget=CKEditorUploadingWidget(), required=False, **field_labels(Problem, 'text_org'))
zamereni = TaggitField(widget=TaggitWidget('TagAutocomplete'), required=False) zamereni = TaggitField(widget=TaggitWidget('TagAutocomplete'), required=False)
autor = UserModelChoiceField(User.objects.filter(is_staff=True)) autor = UserModelChoiceField(User.objects.filter(is_staff=True))
opravovatel = UserModelChoiceField(User.objects.filter(is_staff=True), required=False) opravovatel = UserModelChoiceField(User.objects.filter(is_staff=True), required=False)
@ -536,9 +536,9 @@ create_modeladmin(ProblemZadanyAdmin, Problem, 'ProblemZadany', verbose_name=u'P
### Prispevek (k tematkum) ### Prispevek (k tematkum)
class PrispevekAdminForm(forms.ModelForm): class PrispevekAdminForm(forms.ModelForm):
text_org = forms.CharField(widget=CKEditorWidget(), required=False, text_org = forms.CharField(widget=CKEditorUploadingWidget(), required=False,
**field_labels(Prispevek, 'text_org')) **field_labels(Prispevek, 'text_org'))
text_resitel = forms.CharField(widget=CKEditorWidget(), required=False, text_resitel = forms.CharField(widget=CKEditorUploadingWidget(), required=False,
**field_labels(Prispevek, 'text_resitel')) **field_labels(Prispevek, 'text_resitel'))
class Meta: class Meta:
@ -554,7 +554,7 @@ admin.site.register(Prispevek, PrispevekAdmin)
### Soustredeni ### Soustredeni
class SoustredeniAdminForm(forms.ModelForm): class SoustredeniAdminForm(forms.ModelForm):
text = forms.CharField(widget=CKEditorWidget(), required=False, **field_labels(Soustredeni, 'text')) text = forms.CharField(widget=CKEditorUploadingWidget(), required=False, **field_labels(Soustredeni, 'text'))
class Meta: class Meta:
model = Soustredeni model = Soustredeni
exclude = [] exclude = []
@ -595,7 +595,7 @@ admin.site.register(Konfera,KonferaAdmin)
### Novinky ### Novinky
class NovinkyAdminForm(forms.ModelForm): class NovinkyAdminForm(forms.ModelForm):
text = forms.CharField(widget=CKEditorWidget(), required=False, text = forms.CharField(widget=CKEditorUploadingWidget(), required=False,
**field_labels(Novinky, 'text')) **field_labels(Novinky, 'text'))
autor = UserModelChoiceField(User.objects.filter(is_staff=True)) autor = UserModelChoiceField(User.objects.filter(is_staff=True))

2
seminar/templates/seminar/archiv/cislo_vysledkovka.tex

@ -1,6 +1,6 @@
\setlength{\tabcolsep}{3pt} \setlength{\tabcolsep}{3pt}
\begin{longtable}{|r|l|c|r|{% for p in problemy %}c@{\hskip.5em}{% endfor %}|r|r|}\hline \begin{longtable}{|r|l|c|r|{% for p in problemy %}c@{\hskip.5em}{% endfor %}|r|r|}\hline
& & & & \multicolumn{ {{ problemy|length}} }{c|}{\textbf{Úlohy}} & & \\\textbf{Poř.}& \textbf{Jméno}& \textbf{R.}& \raisebox{0.7mm}{$\sum_{-1}$}& {% for p in problemy %}{% if p.typ == "uloha" %}\textbf{r{{p.kod}}}&{% elif p.typ = "tema" %}\textbf{t{{p.kod}}}&{% else %}\textbf{ {{p.kod}} }&{% endif %}{% endfor %}\raisebox{0.7mm}{$\sum_0$}&\raisebox{0.7mm}{$\sum_1$}\\\hline & & & & \multicolumn{ {{ problemy|length}} }{c|}{\textbf{Úlohy}} & & \\\textbf{Poř.}& \textbf{Jméno}& \textbf{R.}& \raisebox{0.7mm}{$\sum_{-1}$}& {% for p in problemy %}{% if p.typ == "uloha" %}\textbf{r{{p.kod}}}&{% elif p.typ == "tema" %}\textbf{t{{p.kod}}}&{% else %}\textbf{ {{p.kod}} }&{% endif %}{% endfor %}\raisebox{0.7mm}{$\sum_0$}&\raisebox{0.7mm}{$\sum_1$}\\\hline
\endhead \endhead
\hline \hline
\endfoot \endfoot

138
seminar/templates/seminar/archiv/obalky.tex

@ -1,79 +1,97 @@
{% autoescape off %} {% autoescape off %}
{% load staticfiles %} {% load staticfiles %}
{% load tex %} {% load tex %}
\input czech.sty \documentclass[11pt,a4paper,landscape]{article}
\input epsf \usepackage[top=3.75cm,left=8cm]{geometry}
\special{landscape} \usepackage[T1]{fontenc}
\nopagenumbers \usepackage[utf8]{inputenc}
\hoffset=-1in \usepackage[czech]{babel}
\voffset=-1in \usepackage{graphicx}
\advance\voffset by 0.9cm \begin{document}
%nove pridano, aby to fungovalo...
\advance\hoffset by 6.5cm % Nechceme číslování stránek
\hsize=22cm \pagenumbering{gobble}
\vsize=16cm
% Různé fonty na obálce
\font\adrfonta=csssbx10 at 14pt \def\adrfonta#1{%
\font\adrfontb=csssbx10 at 12pt \fontsize{14pt}{14.5pt}\selectfont \textbf{\textsf{#1}}%Časopis M&M
\font\adrfontc=csss12 }
\font\tofont=csr12 at 16pt \def\adrfontb#1{%
\fontsize{12pt}{13pt}\selectfont \textbf{\textsf{#1}}%OPMK UK MFF
\newdimen\fromskip }
\newdimen\toskip \def\adrfontc#1{%
\fromskip=4.35cm \fontsize{12pt}{13pt}\selectfont \textsf{#1}%Adresa, telefon, e-mail
\toskip=13.2cm }
\def\tofont#1{%
\def\first{\relax} \fontsize{16pt}{18pt}\selectfont #1%Adresa řešitele
}
%Podtržítko je znak
\catcode`_=13 \catcode`_=13
%\catcode`_=12
\def_{$\_$} \def_{$\_$}
\advance\voffset by 2.5cm % Odsazení různých adres
\parindent=0pt
%\newdimen\fromskip
\def\obalka#1#2#3#4#5#6#7{ \newdimen\toskip
%\fromskip=4.35cm
\def\jmeno{#1} \toskip=11.7cm
\def\prijm{#2}
\def\skola{#3} % Předsunutí -- na PSČ
\def\popis{} \def\predsunout#1{%
\def\first{} \setbox0=\hbox{#1\,}%
\def\ulice{#4} \hskip -\wd0\relax%
\def\PSC{#5} \box0
\def\mesto{#6} }
\def\stat{#7}
\vskip-4mm\vbox to 0pt{\hbox to 0pt{\hskip1.4cm\epsfysize=2.55cm\epsfbox{lisak.eps}\hss}\vss}
\baselineskip=13pt % Makro na TeXáni naší adresy
\parindent=\fromskip \def\adresaMaM{%
\line{\indent\adrfonta Časopis M\&M,\hfil} \hbox{\adrfonta{Časopis M\&M,}}
\vskip 3 pt \vskip 3 pt
\line{\indent\adrfontb OPMK UK MFF\hfil} \hbox{\adrfontb{OPMK UK MFF}}
\vskip 3 pt \vskip 3 pt
\line{\indent\adrfontc Ke Karlovu 3, 121 16 Praha 2\hfil} \hbox{\adrfontc{Ke Karlovu 3, 121 16 Praha 2}}
\line{\indent\adrfontc Tel.: +420 221 911 235\hss} \hbox{\adrfontc{Tel.: +420 221 911 235}}
\line{\indent\adrfontc mam@atrey.karlin.mff.cuni.cz\hfil} \hbox{\adrfontc{mam@matfyz.cz}}
}
\vskip6.15cm % Makro na TeXání adresátovy adresy
\vbox to 0pt{\parindent=1.4cm\hsize=\toskip\advance\hsize by -1cm \def\adresat#1#2#3#4#5#6#7{%
\vbox to 60pt{\vfil} \popis\vss} \def\jmeno{#1}%
\parindent=\toskip \def\prijm{#2}%
\baselineskip=18pt \def\skola{#3}%
\line{\indent\tofont\first\hfil} %\def\popis{}
\line{\indent\tofont\jmeno\ \prijm\hfil} %\def\first{}
\def\ulice{#4}%
\def\PSC{#5}%
\def\mesto{#6}%
\def\stat{#7}%
\hbox{\tofont{\jmeno\ \prijm}}
\vskip .2 em
\ifx \skola \empty \ifx \skola \empty
{} {}
\else \else
\line{\indent\tofont\skola\hfil} \hbox{\tofont{\skola}}
\fi \fi
\line{\indent\tofont\ulice\hfil} \vskip .2 em
\line{\tofont\item{\PSC} \mesto\hfil} \hbox{\tofont{\ulice}}
\vskip .2 em
\vskip .2 em
\hbox to 18pt{\tofont{\predsunout{\PSC\ }\mesto}}
\vskip 5 pt \vskip 5 pt
\line{\indent\tofont\stat\hfil} \tofont{\stat}
}
\vfil\eject % Tohle makro vysází samotnou obálku
\def\obalka#1#2#3#4#5#6#7{
% Horní a pravý okraj je zároveň okraj stránky, resetujeme odsazení
\includegraphics[height=2.55cm]{lisak.eps}\hskip 1 em\vbox{%
\adresaMaM}
\vskip 7.3 cm % Od oka
\hskip\toskip%
\vbox{\adresat{#1}{#2}{#3}{#4}{#5}{#6}{#7}}
\vfill\eject
} }
@ -98,6 +116,6 @@
{% endif %} {% endif %}
{% endspaceless %} {% endspaceless %}
{% endfor %} {% endfor %}
\bye \end{document}
{% endautoescape %} {% endautoescape %}

17
seminar/views.py

@ -502,7 +502,7 @@ class CisloView(generic.DetailView):
class ArchivTemataView(generic.ListView): class ArchivTemataView(generic.ListView):
model = Problem model = Problem
template_name = 'seminar/archiv/temata.html' template_name = 'seminar/archiv/temata.html'
queryset = Problem.objects.filter(typ=Problem.TYP_TEMA, stav=Problem.STAV_ZADANY).select_related('cislo_zadani__rocnik__rocnik').order_by('-cislo_zadani__rocnik__rocnik', 'kod') queryset = Problem.objects.filter(typ=Problem.TYP_TEMA, stav=Problem.STAV_ZADANY).select_related('cislo_zadani__rocnik').order_by('-cislo_zadani__rocnik__rocnik', 'kod')
### Generovani vysledkovky ### Generovani vysledkovky
@ -552,9 +552,8 @@ def aktivniResitele(rocnik,cislo):
if int(cislo) > 3: if int(cislo) > 3:
problemy = Problem.objects.filter(cislo_zadani = letos.cisla) problemy = Problem.objects.filter(cislo_zadani = letos.cisla)
else: else:
problemy = Problem.objects.filter(Q(cislo_zadani = letos.cisla)|Q(cislo_zadani=loni.cisla)) problemy = Problem.objects.filter(Q(cislo_zadani__in = letos.cisla)|Q(cislo_zadani__in = loni.cisla))
resitele = aktualni_resitele.filter(reseni = Reseni.objects.filter(problem=problemy)).distinct() resitele = aktualni_resitele.filter(reseni__in = Reseni.objects.filter(problem__in=problemy)).distinct()
return resitele return resitele
@ -567,11 +566,9 @@ def obalkyView(request,resitele):
tempdir = tempfile.mkdtemp() tempdir = tempfile.mkdtemp()
with open(tempdir+"/obalky.tex","w") as texfile: with open(tempdir+"/obalky.tex","w") as texfile:
# Pokud TeX chce ISO Latin, tak se da encode nastavit texfile.write(tex)
texfile.write(tex.decode("utf-8").encode("iso-8859-2"))
shutil.copy(os.path.join(settings.STATIC_ROOT, 'seminar/lisak.eps'),tempdir) shutil.copy(os.path.join(settings.STATIC_ROOT, 'seminar/lisak.eps'),tempdir)
subprocess.call(["csplain","obalky.tex"],cwd = tempdir) subprocess.call(["pdflatex","obalky.tex"],cwd = tempdir)
subprocess.call(["dvipdf","obalky.dvi"],cwd = tempdir)
with open(tempdir+"/obalky.pdf","rb") as pdffile: with open(tempdir+"/obalky.pdf","rb") as pdffile:
response = HttpResponse(pdffile.read(),content_type='application/pdf') response = HttpResponse(pdffile.read(),content_type='application/pdf')
@ -707,12 +704,12 @@ def soustredeniUcastniciExportView(request,soustredeni):
class ClankyResitelView(generic.ListView): class ClankyResitelView(generic.ListView):
model = Problem model = Problem
template_name = 'seminar/clanky/resitelske_clanky.html' template_name = 'seminar/clanky/resitelske_clanky.html'
queryset = Problem.objects.filter(typ=Problem.TYP_RES_CLANEK, stav=Problem.STAV_ZADANY).select_related('cislo_zadani__rocnik__rocnik').order_by('-cislo_zadani__rocnik__rocnik', 'kod') queryset = Problem.objects.filter(typ=Problem.TYP_RES_CLANEK, stav=Problem.STAV_ZADANY).select_related('cislo_zadani__rocnik').order_by('-cislo_zadani__rocnik__rocnik', 'kod')
class ClankyOrganizatorView(generic.ListView): class ClankyOrganizatorView(generic.ListView):
model = Problem model = Problem
template_name = 'seminar/clanky/organizatorske_clanky.html' template_name = 'seminar/clanky/organizatorske_clanky.html'
queryset = Problem.objects.filter(typ=Problem.TYP_ORG_CLANEK, stav=Problem.STAV_ZADANY).select_related('cislo_zadani__rocnik__rocnik').order_by('-cislo_zadani__rocnik__rocnik', 'kod') queryset = Problem.objects.filter(typ=Problem.TYP_ORG_CLANEK, stav=Problem.STAV_ZADANY).select_related('cislo_zadani__rocnik').order_by('-cislo_zadani__rocnik__rocnik', 'kod')
### Status ### Status

Loading…
Cancel
Save