|
@ -20,18 +20,50 @@ def zobrazit(galerie, request): |
|
|
raise Http404 |
|
|
raise Http404 |
|
|
return preview |
|
|
return preview |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def cesta_od_korene(g): |
|
|
|
|
|
"""Vrátí seznam galerií od kořene ke g""" |
|
|
|
|
|
cesta = [] |
|
|
|
|
|
while g != None: |
|
|
|
|
|
cesta.append(g) |
|
|
|
|
|
g = g.galerie_up |
|
|
|
|
|
return reversed(cesta) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) |
|
|
podgalerie = Galerie.objects.filter(galerie_up = galerie).order_by('poradi') |
|
|
podgalerie = Galerie.objects.filter(galerie_up = galerie).order_by('poradi') |
|
|
obrazky = Obrazek.objects.filter(galerie = galerie).order_by('datum') |
|
|
obrazky = Obrazek.objects.filter(galerie = galerie).order_by('datum') |
|
|
preview = zobrazit(galerie, request) |
|
|
preview = zobrazit(galerie, request) |
|
|
return render(request, 'galerie/GalerieNahled.html', |
|
|
|
|
|
{'galerie' : galerie, |
|
|
sourozenci = [] |
|
|
'podgalerie' : podgalerie, |
|
|
if galerie.galerie_up: |
|
|
'obrazky' : obrazky, |
|
|
sourozenci = galerie.galerie_up.galerie_set.all().order_by('poradi') |
|
|
'preview' : preview, |
|
|
|
|
|
}) |
|
|
predchozi = None |
|
|
|
|
|
nasledujici = None |
|
|
|
|
|
minuly = None |
|
|
|
|
|
for g in sourozenci: |
|
|
|
|
|
if g.pk == galerie.pk: |
|
|
|
|
|
predchozi = minuly |
|
|
|
|
|
if minuly != None and minuly.pk == galerie.pk: |
|
|
|
|
|
nasledujici = g |
|
|
|
|
|
break |
|
|
|
|
|
minuly = g |
|
|
|
|
|
|
|
|
|
|
|
cesta = cesta_od_korene(galerie) |
|
|
|
|
|
|
|
|
|
|
|
return render(request, 'galerie/GalerieNahled.html', |
|
|
|
|
|
{'galerie' : galerie, |
|
|
|
|
|
'podgalerie' : podgalerie, |
|
|
|
|
|
'obrazky' : obrazky, |
|
|
|
|
|
'preview' : preview, |
|
|
|
|
|
'cesta': cesta, |
|
|
|
|
|
'sourozenci': sourozenci, |
|
|
|
|
|
'predchozi': predchozi, |
|
|
|
|
|
'nasledujici': nasledujici, |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
def detail(request, pk, fotka, soustredeni): |
|
|
def detail(request, pk, fotka, soustredeni): |
|
|
"""Zobrazeni nahledu fotky s id 'fotka'.""" |
|
|
"""Zobrazeni nahledu fotky s id 'fotka'.""" |
|
@ -90,6 +122,7 @@ def detail(request, pk, fotka, soustredeni): |
|
|
'obrazky_dalsi' : obrazky_dalsi, |
|
|
'obrazky_dalsi' : obrazky_dalsi, |
|
|
'preview' : preview, |
|
|
'preview' : preview, |
|
|
'form' : form, |
|
|
'form' : form, |
|
|
|
|
|
'cesta': cesta_od_korene(galerie), |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|