galerie | clone detail fotky + uprava pro M&M
This commit is contained in:
parent
626e4f21a5
commit
44903958dc
2 changed files with 63 additions and 17 deletions
47
galerie/templates/galerie/Galerie.html
Normal file
47
galerie/templates/galerie/Galerie.html
Normal file
|
@ -0,0 +1,47 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}{% block nadpis1a %}
|
||||
{{galerie.nazev}} | Galerie
|
||||
{% endblock %}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1><a title="Zpět na náhled fotek" href="../#obsah">{{galerie.nazev}}</a></h1>
|
||||
<div class="galerie_top" id="obsah">
|
||||
{% for obrazek in obrazky_predchozi %}
|
||||
<a href="../{{obrazek.pk}}#obsah"><img src="{{obrazek.obrazek_maly.url}}" height="100"></a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
|
||||
{# TODO šipky na přecházeni dodelat ve stylech #}
|
||||
<div class="galerie">
|
||||
{% if obrazky_predchozi %}
|
||||
{% with obrazky_predchozi|last as predchozi_obrazek %}
|
||||
<div>
|
||||
<a title="Předchozí" class="predchozi_obrazek" href="../{{predchozi_obrazek.pk}}#obsah"></a>
|
||||
</div>
|
||||
{% endwith %}
|
||||
{% endif%}
|
||||
<img src={{obrazek.obrazek_stredni.url}}
|
||||
height="{{vyska}}"
|
||||
width="{{sirka}}"
|
||||
alt="{{obrazek.popis}}"
|
||||
class="obrazek">
|
||||
{% if obrazky_dalsi %}
|
||||
{% with obrazky_dalsi|first as dalsi_obrazek %}
|
||||
<div>
|
||||
<a title="Další" class="dalsi_obrazek" href="../{{dalsi_obrazek.pk}}#obsah"></a>
|
||||
</div>
|
||||
{% endwith %}
|
||||
{% endif%}
|
||||
</div>
|
||||
<div class="popis">
|
||||
{{obrazek.popis}}
|
||||
</div>
|
||||
|
||||
<div class="galerie_bot">
|
||||
{% for obrazek in obrazky_dalsi %}
|
||||
<a href="../{{obrazek.pk}}#obsah"><img src="{{obrazek.obrazek_maly.url}}" height="100"></a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -27,37 +27,37 @@ from seminar.models import Soustredeni
|
|||
#'umisteni_Fotogalerie' : True,
|
||||
#})
|
||||
|
||||
def zobrazit(galerie, request):
|
||||
preview = False
|
||||
if galerie.zobrazit >= 1:
|
||||
if request.user.is_staff:
|
||||
preview = True;
|
||||
else:
|
||||
raise Http404
|
||||
return preview
|
||||
|
||||
|
||||
def nahled(request, pk, soustredeni):
|
||||
"""Zobrazeni nahledu vsech fotek ve skupine."""
|
||||
galerie = get_object_or_404(Galerie, pk=pk)
|
||||
preview = False
|
||||
if galerie.zobrazit >= 1:
|
||||
if request.user.is_staff:
|
||||
preview = True;
|
||||
else:
|
||||
raise Http404
|
||||
preview = zobrazit(galerie, request)
|
||||
return render(request, 'galerie/GalerieNahled.html',
|
||||
{'galerie' : galerie,
|
||||
'preview' : preview,
|
||||
})
|
||||
|
||||
def detail(request, pk, fotka):
|
||||
def detail(request, pk, fotka, soustredeni):
|
||||
"""Zobrazeni nahledu fotky s id 'fotka'."""
|
||||
MAX_VYSKA = 600
|
||||
MAX_SIRKA = 600
|
||||
MAX_VYSKA_MALA = 100
|
||||
MAX_SIRKA_MALA = 200
|
||||
NAHLEDU = 3
|
||||
NAHLEDU = 1
|
||||
|
||||
galerie = get_object_or_404(Galerie, pk=pk)
|
||||
preview = False
|
||||
if not galerie.je_publikovano():
|
||||
if request.user.is_authenticated():
|
||||
preview = True;
|
||||
else:
|
||||
raise Http404
|
||||
preview = zobrazit(galerie, request)
|
||||
obrazek = get_object_or_404(Obrazek, pk=fotka)
|
||||
obrazky = galerie.obrazky.all()
|
||||
obrazky = galerie.obrazek_set.all()
|
||||
|
||||
# Poradi aktualniho obrazku v galerii/stitku.
|
||||
for i in range(len(obrazky)):
|
||||
|
@ -85,7 +85,7 @@ def detail(request, pk, fotka):
|
|||
vyska = vyska * MAX_SIRKA / sirka
|
||||
sirka = MAX_SIRKA
|
||||
|
||||
return render(request, 'Galerie/Galerie.html',
|
||||
return render(request, 'galerie/Galerie.html',
|
||||
{'galerie' : galerie,
|
||||
'obrazek' : obrazek,
|
||||
'vyska' : vyska,
|
||||
|
@ -93,6 +93,5 @@ def detail(request, pk, fotka):
|
|||
'obrazky_predchozi' : obrazky_predchozi,
|
||||
'obrazky_dalsi' : obrazky_dalsi,
|
||||
'preview' : preview,
|
||||
'umisteni_Fotogalerie' : True,
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in a new issue