|
@ -20,17 +20,49 @@ 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) |
|
|
|
|
|
|
|
|
|
|
|
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', |
|
|
return render(request, 'galerie/GalerieNahled.html', |
|
|
{'galerie' : galerie, |
|
|
{'galerie' : galerie, |
|
|
'podgalerie' : podgalerie, |
|
|
'podgalerie' : podgalerie, |
|
|
'obrazky' : obrazky, |
|
|
'obrazky' : obrazky, |
|
|
'preview' : preview, |
|
|
'preview' : preview, |
|
|
|
|
|
'cesta': cesta, |
|
|
|
|
|
'sourozenci': sourozenci, |
|
|
|
|
|
'predchozi': predchozi, |
|
|
|
|
|
'nasledujici': nasledujici, |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
def detail(request, pk, fotka, soustredeni): |
|
|
def detail(request, pk, fotka, soustredeni): |
|
@ -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), |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|