Obalky pro ucastniky soustredeni.
This commit is contained in:
parent
237a88ceed
commit
5ac41bc821
2 changed files with 9 additions and 2 deletions
|
@ -18,6 +18,7 @@ urlpatterns = patterns('',
|
||||||
name = 'seminar_seznam_soustredeni'),
|
name = 'seminar_seznam_soustredeni'),
|
||||||
url(r'^soustredeni/probehlo/(?P<soustredeni>\d+)/$', views.SoustredeniView.as_view(), name='seminar_soustredeni'),
|
url(r'^soustredeni/probehlo/(?P<soustredeni>\d+)/$', views.SoustredeniView.as_view(), name='seminar_soustredeni'),
|
||||||
url(r'^soustredeni/(?P<soustredeni>\d+)/fotogalerie/', include('galerie.urls')),
|
url(r'^soustredeni/(?P<soustredeni>\d+)/fotogalerie/', include('galerie.urls')),
|
||||||
|
url(r'^soustredeni/(?P<soustredeni>\d+)/obalky.pdf', views.soustredeniObalkyView,name='seminar_soustredeni_obalky'),
|
||||||
|
|
||||||
url(r'^zadani/aktualni/$', views.AktualniZadaniView, name='seminar_aktualni_zadani'),
|
url(r'^zadani/aktualni/$', views.AktualniZadaniView, name='seminar_aktualni_zadani'),
|
||||||
url(r'^zadani/temata/$', views.ZadaniTemataView, name='seminar_temata'),
|
url(r'^zadani/temata/$', views.ZadaniTemataView, name='seminar_temata'),
|
||||||
|
|
|
@ -8,7 +8,7 @@ from django.views import generic
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
from django.http import Http404
|
from django.http import Http404
|
||||||
|
|
||||||
from .models import Problem, Cislo, Reseni, Nastaveni, Rocnik, Soustredeni, Organizator, Resitel, Novinky
|
from .models import Problem, Cislo, Reseni, Nastaveni, Rocnik, Soustredeni, Organizator, Resitel, Novinky, Soustredeni_Ucastnici
|
||||||
from .models import VysledkyZaCislo, VysledkyKCisluZaRocnik, VysledkyKCisluOdjakziva
|
from .models import VysledkyZaCislo, VysledkyKCisluZaRocnik, VysledkyKCisluOdjakziva
|
||||||
from . import utils
|
from . import utils
|
||||||
|
|
||||||
|
@ -369,14 +369,15 @@ 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.decode("utf-8").encode("utf-8"))
|
texfile.write(tex.decode("utf-8").encode("utf-8"))
|
||||||
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(["csplain","obalky.tex"],cwd = tempdir)
|
||||||
subprocess.call(["dvipdf","obalky.dvi"],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')
|
||||||
|
shutil.rmtree(tempdir)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
@ -390,6 +391,11 @@ class SoustredeniView(generic.DetailView):
|
||||||
model = Soustredeni
|
model = Soustredeni
|
||||||
template_name = 'seminar/archiv/soustredeni.html'
|
template_name = 'seminar/archiv/soustredeni.html'
|
||||||
|
|
||||||
|
def soustredeniObalkyView(request,soustredeni):
|
||||||
|
soustredeni = Soustredeni.objects.filter(id = soustredeni)[0]
|
||||||
|
return obalkyView(request,soustredeni.ucastnici.all())
|
||||||
|
|
||||||
|
|
||||||
### Články
|
### Články
|
||||||
|
|
||||||
class ClankyResitelView(generic.ListView):
|
class ClankyResitelView(generic.ListView):
|
||||||
|
|
Loading…
Reference in a new issue