|
@ -11,25 +11,6 @@ from galerie.models import Obrazek, Galerie |
|
|
from seminar.models import Soustredeni |
|
|
from seminar.models import Soustredeni |
|
|
from galerie.forms import KomentarForm, NewGalerieForm |
|
|
from galerie.forms import KomentarForm, NewGalerieForm |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#def index(request, stitek=None): |
|
|
|
|
|
#if stitek == None: |
|
|
|
|
|
#return HttpResponseRedirect('./0/') |
|
|
|
|
|
# |
|
|
|
|
|
#galerie = Galerie.publikovane_galerie() |
|
|
|
|
|
#if int(stitek) != 0: |
|
|
|
|
|
#galerie = galerie.filter(stitek = stitek) |
|
|
|
|
|
#if not galerie: |
|
|
|
|
|
#raise Http404 |
|
|
|
|
|
#galerie = galerie.order_by("-datum_zmeny") |
|
|
|
|
|
# |
|
|
|
|
|
#return render(request, 'Galerie/GalerieIndex.html', |
|
|
|
|
|
#{'galerie' : galerie, |
|
|
|
|
|
#'stitky' : Stitek.stitky_u_galerii(), |
|
|
|
|
|
#'umisteni_stitek' : stitek, |
|
|
|
|
|
#'umisteni_Fotogalerie' : True, |
|
|
|
|
|
#}) |
|
|
|
|
|
|
|
|
|
|
|
def zobrazit(galerie, request): |
|
|
def zobrazit(galerie, request): |
|
|
preview = False |
|
|
preview = False |
|
|
if galerie.zobrazit >= 1: |
|
|
if galerie.zobrazit >= 1: |
|
@ -39,13 +20,14 @@ def zobrazit(galerie, request): |
|
|
raise Http404 |
|
|
raise Http404 |
|
|
return preview |
|
|
return preview |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def nahled(request, pk, soustredeni): |
|
|
def nahled(request, pk, soustredeni): |
|
|
"""Zobrazeni nahledu vsech fotek ve skupine.""" |
|
|
"""Zobrazeni nahledu vsech fotek ve skupine.""" |
|
|
galerie = get_object_or_404(Galerie, pk=pk) |
|
|
galerie = get_object_or_404(Galerie, pk=pk) |
|
|
|
|
|
obrazky = Obrazek.objects.filter(galerie = galerie).order_by('datum') |
|
|
preview = zobrazit(galerie, request) |
|
|
preview = zobrazit(galerie, request) |
|
|
return render(request, 'galerie/GalerieNahled.html', |
|
|
return render(request, 'galerie/GalerieNahled.html', |
|
|
{'galerie' : galerie, |
|
|
{'galerie' : galerie, |
|
|
|
|
|
'obrazky' : obrazky, |
|
|
'preview' : preview, |
|
|
'preview' : preview, |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
@ -60,7 +42,7 @@ def detail(request, pk, fotka, soustredeni): |
|
|
galerie = get_object_or_404(Galerie, pk=pk) |
|
|
galerie = get_object_or_404(Galerie, pk=pk) |
|
|
preview = zobrazit(galerie, request) |
|
|
preview = zobrazit(galerie, request) |
|
|
obrazek = get_object_or_404(Obrazek, pk=fotka) |
|
|
obrazek = get_object_or_404(Obrazek, pk=fotka) |
|
|
obrazky = galerie.obrazek_set.all() |
|
|
obrazky = galerie.obrazek_set.all().order_by('datum') |
|
|
|
|
|
|
|
|
# vytvoreni a obslouzeni formulare |
|
|
# vytvoreni a obslouzeni formulare |
|
|
if request.method == 'POST': |
|
|
if request.method == 'POST': |
|
@ -146,7 +128,6 @@ def new_galerie(request, galerie, soustredeni): |
|
|
o = Obrazek() |
|
|
o = Obrazek() |
|
|
o.obrazek_velky = obr |
|
|
o.obrazek_velky = obr |
|
|
o.nazev = str(obr) |
|
|
o.nazev = str(obr) |
|
|
o.datum = datetime.now() #TODO vycist z EXIFU |
|
|
|
|
|
o.galerie = gal |
|
|
o.galerie = gal |
|
|
o.save() |
|
|
o.save() |
|
|
|
|
|
|
|
|