opravy bad designu
This commit is contained in:
parent
0f6f6a85b6
commit
c8dd54e8ba
2 changed files with 17 additions and 16 deletions
|
@ -44,15 +44,15 @@ urlpatterns = [
|
|||
org_required(views.SoustredeniAbstraktyView.as_view()),
|
||||
name='soustredeni_abstrakty'
|
||||
),
|
||||
path(
|
||||
'kontaktnicek_pdf',
|
||||
views.soustredeniKontaktnicekPdfView,
|
||||
name='soustredeni_kontaktnicek'
|
||||
path(
|
||||
'kontaktnicek_pdf',
|
||||
views.soustredeniKontaktnicekPdfView,
|
||||
name='soustredeni_kontaktnicek'
|
||||
),
|
||||
path(
|
||||
'kontaktnicek_vcf',
|
||||
views.soustredeniKontaktnicekVcfView,
|
||||
name='soustredeni_kontaktnicek'
|
||||
path(
|
||||
'kontaktnicek_vcf',
|
||||
views.soustredeniKontaktnicekVcfView,
|
||||
name='soustredeni_kontaktnicek'
|
||||
),
|
||||
path(
|
||||
'fotogalerie/',
|
||||
|
@ -60,5 +60,5 @@ urlpatterns = [
|
|||
),
|
||||
]
|
||||
)
|
||||
)
|
||||
)
|
||||
]
|
||||
|
|
|
@ -2,6 +2,7 @@ from django.shortcuts import get_object_or_404, render
|
|||
from django.http import HttpResponse
|
||||
from django.views import generic
|
||||
from django.contrib.staticfiles.finders import find
|
||||
from django.http import Http404
|
||||
|
||||
import csv
|
||||
import tempfile
|
||||
|
@ -118,12 +119,12 @@ def soustredeniKontaktnicekView(request, soustredeni, typ):
|
|||
soustredeni = get_object_or_404(Soustredeni, id=soustredeni)
|
||||
|
||||
if (not request.user in [u.osoba.user for u in soustredeni.ucastnici.all()]):
|
||||
if not request.user.je_org:
|
||||
return HttpResponse("Nebyl jsi tam nebo nejsi org")
|
||||
if not soustredeni.kontaktnicek_pdf and typ == "pdf":
|
||||
return HttpResponse("Kontaktníček není k dispozici")
|
||||
elif not soustredeni.kontaktnicek_vcf and typ == "vcf":
|
||||
return HttpResponse("Kontaktníček není k dispozici")
|
||||
if not request.user.je_org: # nebyl jsi tam, nebo nejsi org
|
||||
raise Http404()
|
||||
if not soustredeni.kontaktnicek_pdf and typ == "pdf": # není k dispozici
|
||||
raise Http404()
|
||||
elif not soustredeni.kontaktnicek_vcf and typ == "vcf": # není k dispozici
|
||||
raise Http404()
|
||||
|
||||
if typ == "pdf":
|
||||
with open(soustredeni.kontaktnicek_pdf.path, 'rb') as pdf:
|
||||
|
@ -134,4 +135,4 @@ def soustredeniKontaktnicekView(request, soustredeni, typ):
|
|||
response = HttpResponse(vcf.read(), content_type='text/vcard')
|
||||
return response
|
||||
else:
|
||||
return HttpResponse("Neplatný typ kontaktníčku")
|
||||
raise ValueError("Nepodporovaný typ kontaktníčku")
|
||||
|
|
Loading…
Reference in a new issue