galerie | vytvoreni odkazu na vytvareni novych (pod)galerii
This commit is contained in:
parent
429b976c2b
commit
9c59e6dec3
5 changed files with 21 additions and 1 deletions
|
@ -7,5 +7,4 @@ class KomentarForm(forms.Form):
|
||||||
komentar = forms.CharField(label = "Komentář:", max_length = 300, required=False)
|
komentar = forms.CharField(label = "Komentář:", max_length = 300, required=False)
|
||||||
|
|
||||||
class NewGalerieForm(forms.Form):
|
class NewGalerieForm(forms.Form):
|
||||||
soustredeni = forms.ModelChoiceField(queryset = Soustredeni.objects, label = "Soustředění") # TODO zrusit a vybrat z URL
|
|
||||||
nazev = forms.CharField(label = "Název galerie", max_length = 100)
|
nazev = forms.CharField(label = "Název galerie", max_length = 100)
|
||||||
|
|
|
@ -19,6 +19,9 @@
|
||||||
<li><a href="../{{galerie.pk}}">{{galerie}}</a>
|
<li><a href="../{{galerie.pk}}">{{galerie}}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
{% if user.is_staff %}
|
||||||
|
<li><a href="./new">VYTVOŘIT NOVOU PODGALERII </a>
|
||||||
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,8 @@ Vytvářím novou galerii
|
||||||
|
|
||||||
<h2> Vytváření nové galerie </h2>
|
<h2> Vytváření nové galerie </h2>
|
||||||
|
|
||||||
|
<h3> Vytvářím galerii k soustředění {{soustredeni}} jako {{galerie_text}}</h3>
|
||||||
|
|
||||||
<form enctype="multipart/form-data" action="." method="post">
|
<form enctype="multipart/form-data" action="." method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<table>{{form.as_table}}
|
<table>{{form.as_table}}
|
||||||
|
|
|
@ -109,6 +109,14 @@ def detail(request, pk, fotka, soustredeni):
|
||||||
|
|
||||||
|
|
||||||
def new_galerie(request, galerie, soustredeni):
|
def new_galerie(request, galerie, soustredeni):
|
||||||
|
|
||||||
|
soustredeni = get_object_or_404(Soustredeni, pk = soustredeni)
|
||||||
|
if int(galerie) == 0:
|
||||||
|
galerie_text = "Hlavní fotogalerie soustředění"
|
||||||
|
else:
|
||||||
|
galerie = get_object_or_404(Galerie, pk = int(galerie))
|
||||||
|
galerie_text = "podgalerii ke galerii " + str(galerie)
|
||||||
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
form = NewGalerieForm(request.POST, request.FILES)
|
form = NewGalerieForm(request.POST, request.FILES)
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
|
@ -120,7 +128,10 @@ def new_galerie(request, galerie, soustredeni):
|
||||||
else:
|
else:
|
||||||
form = NewGalerieForm()
|
form = NewGalerieForm()
|
||||||
|
|
||||||
|
|
||||||
return render(request, 'galerie/GalerieNew.html',
|
return render(request, 'galerie/GalerieNew.html',
|
||||||
{
|
{
|
||||||
'form' : form,
|
'form' : form,
|
||||||
|
'soustredeni' : soustredeni,
|
||||||
|
'galerie_text' : galerie_text,
|
||||||
})
|
})
|
||||||
|
|
|
@ -49,6 +49,11 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if user.is_staff %}
|
||||||
|
<li>
|
||||||
|
<a href="./{{soustredeni.pk}}/fotogalerie/0/new/"> VYTVOŘIT NOVOU FOTOGALERII </a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue