From 6dbd80c2a5d036634ac48e897c18bdb5bd6c32a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Koci=C3=A1n?= Date: Sun, 15 Nov 2015 23:10:58 +0100 Subject: [PATCH] =?UTF-8?q?Galerie:=20nezobrazuj=20neve=C5=99ejn=C3=A9=20p?= =?UTF-8?q?odgalerie=20neorg=C5=AFm?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- galerie/templates/galerie/GalerieNahled.html | 34 +++++++++----------- galerie/views.py | 6 ++++ 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/galerie/templates/galerie/GalerieNahled.html b/galerie/templates/galerie/GalerieNahled.html index 49d72e46..1a4656b4 100644 --- a/galerie/templates/galerie/GalerieNahled.html +++ b/galerie/templates/galerie/GalerieNahled.html @@ -42,28 +42,24 @@ Galerie {{galerie.nazev}}
{% for galerie in podgalerie %} - - {% if galerie.zobrazit < 1 or user.is_staff %} {% if galerie.titulni_obrazek %} - {% with galerie.titulni_obrazek.obrazek_maly as obrazek %} - - {% endwith %} + {% with galerie.titulni_obrazek.obrazek_maly as obrazek %} + + {% endwith %} {% endif %} -
- {{ galerie }} -
- -
- {% if user.is_staff and galerie.zobrazit > 0 %} -
- ({{galerie.poradi}}) - + - - +
+ {{ galerie }}
- {% endif %} - {% endif %} + + {% if user.is_staff and galerie.zobrazit > 0 %} +
+ ({{galerie.poradi}}) + + + - +
+ {% endif %} {% endfor %}
{% endif %} diff --git a/galerie/views.py b/galerie/views.py index 04a574a4..9e23133f 100644 --- a/galerie/views.py +++ b/galerie/views.py @@ -33,13 +33,19 @@ def cesta_od_korene(g): 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') + if not request.user.is_staff: + podgalerie = podgalerie.filter(zobrazit__lt=1) + 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') + if not request.user.is_staff: + sourozenci = sourozenci.filter(zobrazit__lt=1) predchozi = None nasledujici = None