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,
|
#'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):
|
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)
|
||||||
preview = False
|
preview = zobrazit(galerie, request)
|
||||||
if galerie.zobrazit >= 1:
|
|
||||||
if request.user.is_staff:
|
|
||||||
preview = True;
|
|
||||||
else:
|
|
||||||
raise Http404
|
|
||||||
return render(request, 'galerie/GalerieNahled.html',
|
return render(request, 'galerie/GalerieNahled.html',
|
||||||
{'galerie' : galerie,
|
{'galerie' : galerie,
|
||||||
'preview' : preview,
|
'preview' : preview,
|
||||||
})
|
})
|
||||||
|
|
||||||
def detail(request, pk, fotka):
|
def detail(request, pk, fotka, soustredeni):
|
||||||
"""Zobrazeni nahledu fotky s id 'fotka'."""
|
"""Zobrazeni nahledu fotky s id 'fotka'."""
|
||||||
MAX_VYSKA = 600
|
MAX_VYSKA = 600
|
||||||
MAX_SIRKA = 600
|
MAX_SIRKA = 600
|
||||||
MAX_VYSKA_MALA = 100
|
MAX_VYSKA_MALA = 100
|
||||||
MAX_SIRKA_MALA = 200
|
MAX_SIRKA_MALA = 200
|
||||||
NAHLEDU = 3
|
NAHLEDU = 1
|
||||||
|
|
||||||
galerie = get_object_or_404(Galerie, pk=pk)
|
galerie = get_object_or_404(Galerie, pk=pk)
|
||||||
preview = False
|
preview = zobrazit(galerie, request)
|
||||||
if not galerie.je_publikovano():
|
|
||||||
if request.user.is_authenticated():
|
|
||||||
preview = True;
|
|
||||||
else:
|
|
||||||
raise Http404
|
|
||||||
obrazek = get_object_or_404(Obrazek, pk=fotka)
|
obrazek = get_object_or_404(Obrazek, pk=fotka)
|
||||||
obrazky = galerie.obrazky.all()
|
obrazky = galerie.obrazek_set.all()
|
||||||
|
|
||||||
# Poradi aktualniho obrazku v galerii/stitku.
|
# Poradi aktualniho obrazku v galerii/stitku.
|
||||||
for i in range(len(obrazky)):
|
for i in range(len(obrazky)):
|
||||||
|
@ -85,7 +85,7 @@ def detail(request, pk, fotka):
|
||||||
vyska = vyska * MAX_SIRKA / sirka
|
vyska = vyska * MAX_SIRKA / sirka
|
||||||
sirka = MAX_SIRKA
|
sirka = MAX_SIRKA
|
||||||
|
|
||||||
return render(request, 'Galerie/Galerie.html',
|
return render(request, 'galerie/Galerie.html',
|
||||||
{'galerie' : galerie,
|
{'galerie' : galerie,
|
||||||
'obrazek' : obrazek,
|
'obrazek' : obrazek,
|
||||||
'vyska' : vyska,
|
'vyska' : vyska,
|
||||||
|
@ -93,6 +93,5 @@ def detail(request, pk, fotka):
|
||||||
'obrazky_predchozi' : obrazky_predchozi,
|
'obrazky_predchozi' : obrazky_predchozi,
|
||||||
'obrazky_dalsi' : obrazky_dalsi,
|
'obrazky_dalsi' : obrazky_dalsi,
|
||||||
'preview' : preview,
|
'preview' : preview,
|
||||||
'umisteni_Fotogalerie' : True,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue