|
|
@ -20,18 +20,50 @@ def zobrazit(galerie, request): |
|
|
|
raise Http404 |
|
|
|
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): |
|
|
|
"""Zobrazeni nahledu vsech fotek ve skupine.""" |
|
|
|
galerie = get_object_or_404(Galerie, pk=pk) |
|
|
|
podgalerie = Galerie.objects.filter(galerie_up = galerie).order_by('poradi') |
|
|
|
obrazky = Obrazek.objects.filter(galerie = galerie).order_by('datum') |
|
|
|
preview = zobrazit(galerie, request) |
|
|
|
return render(request, 'galerie/GalerieNahled.html', |
|
|
|
{'galerie' : galerie, |
|
|
|
'podgalerie' : podgalerie, |
|
|
|
'obrazky' : obrazky, |
|
|
|
'preview' : preview, |
|
|
|
}) |
|
|
|
"""Zobrazeni nahledu vsech fotek ve skupine.""" |
|
|
|
galerie = get_object_or_404(Galerie, pk=pk) |
|
|
|
podgalerie = Galerie.objects.filter(galerie_up = galerie).order_by('poradi') |
|
|
|
obrazky = Obrazek.objects.filter(galerie = galerie).order_by('datum') |
|
|
|
preview = zobrazit(galerie, request) |
|
|
|
|
|
|
|
sourozenci = [] |
|
|
|
if galerie.galerie_up: |
|
|
|
sourozenci = galerie.galerie_up.galerie_set.all().order_by('poradi') |
|
|
|
|
|
|
|
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): |
|
|
|
"""Zobrazeni nahledu fotky s id 'fotka'.""" |
|
|
@ -90,6 +122,7 @@ def detail(request, pk, fotka, soustredeni): |
|
|
|
'obrazky_dalsi' : obrazky_dalsi, |
|
|
|
'preview' : preview, |
|
|
|
'form' : form, |
|
|
|
'cesta': cesta_od_korene(galerie), |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|