Anet
6 years ago
2 changed files with 71 additions and 66 deletions
@ -0,0 +1,71 @@ |
|||||
|
# Tento soubor slouží k odkládání aktuálně nepotřebného kódu, který by |
||||
|
# se však v budoucnu mohl opět hodit. |
||||
|
|
||||
|
################################################################### |
||||
|
|
||||
|
## Prispevek byl zrusen, mozna ale bude podobny nahled na neco jineho. |
||||
|
#class PrispevekView(generic.DetailView): |
||||
|
# model = Prispevek |
||||
|
# template_name = 'seminar/archiv/prispevek.html' |
||||
|
# |
||||
|
# # Vlastni ziskavani objektu z databaze podle prispevku |
||||
|
# # pokud je prispevek neverejny zobrazi se jenom orgum |
||||
|
# def get_object(self, queryset=None): |
||||
|
# if queryset is None: |
||||
|
# queryset = self.get_queryset() |
||||
|
# problem_arg = self.kwargs.get('pk') |
||||
|
# prispevek_arg = self.kwargs.get('prispevek') |
||||
|
# queryset = queryset.filter(pk=prispevek_arg) |
||||
|
# |
||||
|
# try: |
||||
|
# obj = queryset.get() |
||||
|
# except queryset.model.DoesNotExist: |
||||
|
# raise Http404(_("No %(verbose_name)s found matching the query") % |
||||
|
# {'verbose_name': queryset.model._meta.verbose_name}) |
||||
|
# |
||||
|
# if self.request.user.is_staff or obj.zverejnit: |
||||
|
# return obj |
||||
|
# else: |
||||
|
# raise Http404() |
||||
|
# |
||||
|
# def get_context_data(self, **kwargs): |
||||
|
# context = super(PrispevekView, self).get_context_data(**kwargs) |
||||
|
# # snaho o ziskani titulu |
||||
|
# titul = '' |
||||
|
# try: |
||||
|
# resitel = context['prispevek'].reseni.resitel |
||||
|
# cislo = context['prispevek'].reseni.cislo_body |
||||
|
# body = VysledkyKCisluOdjakziva.objects.get(resitel=resitel, |
||||
|
# cislo=cislo).body |
||||
|
# titul = resitel.get_titul(body) |
||||
|
# except: |
||||
|
# pass |
||||
|
# context['titul'] = titul |
||||
|
# return context |
||||
|
|
||||
|
#################################################################### |
||||
|
|
||||
|
## Stvrzenky aktuálně nevydáváme, ale možná časem zase budeme. |
||||
|
#def soustredeniStvrzenkyExportView(request,soustredeni,first_num): |
||||
|
# first_num = int(first_num) |
||||
|
# soustredeni = get_object_or_404(Soustredeni,id = soustredeni) |
||||
|
# ucastnici = Resitel.objects.filter(soustredeni=soustredeni) |
||||
|
# for (idx,u) in enumerate(ucastnici): |
||||
|
# u.cislo_stvrzenky = first_num+idx; |
||||
|
# tex = render(request,'seminar/soustredeni/ucastnici.tex', {'ucastnici': ucastnici, 'datum':soustredeni.datum_zacatku }).content |
||||
|
# |
||||
|
# tempdir = tempfile.mkdtemp() |
||||
|
# with open(tempdir+"/ucastnici.tex","w") as texfile: |
||||
|
# # Pokud TeX chce ISO Latin, tak se da encode nastavit |
||||
|
# texfile.write(tex.decode("utf-8").encode("utf-8")) |
||||
|
# shutil.copy(os.path.join(settings.STATIC_ROOT, 'seminar/stvrzenka.sty'),tempdir) |
||||
|
# shutil.copy(os.path.join(settings.STATIC_ROOT, 'seminar/stvrzenky.tex'),tempdir) |
||||
|
# subprocess.call(["cslatex","stvrzenky.tex"],cwd = tempdir) |
||||
|
# subprocess.call(["dvipdf","stvrzenky.dvi"],cwd = tempdir) |
||||
|
# |
||||
|
# with open(tempdir+"/stvrzenky.pdf","rb") as pdffile: |
||||
|
# response = HttpResponse(pdffile.read(),content_type='application/pdf') |
||||
|
# shutil.rmtree(tempdir) |
||||
|
# return response |
||||
|
|
||||
|
|
Loading…
Reference in new issue