galerie | vytvareni nove | hruba kostra obsluhu formu
This commit is contained in:
parent
cc59e42e12
commit
429b976c2b
3 changed files with 13 additions and 2 deletions
|
@ -7,5 +7,5 @@ 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í")
|
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)
|
||||||
|
|
|
@ -6,6 +6,8 @@ Vytvářím novou galerii
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
|
<h2> Vytváření nové galerie </h2>
|
||||||
|
|
||||||
<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,7 +109,16 @@ def detail(request, pk, fotka, soustredeni):
|
||||||
|
|
||||||
|
|
||||||
def new_galerie(request, galerie, soustredeni):
|
def new_galerie(request, galerie, soustredeni):
|
||||||
form = NewGalerieForm()
|
if request.method == 'POST':
|
||||||
|
form = NewGalerieForm(request.POST, request.FILES)
|
||||||
|
if form.is_valid():
|
||||||
|
# TODO dopsat vytvoreni fotogalerie
|
||||||
|
for obr in request.FILES.getlist('obr'):
|
||||||
|
pass # TODO dopsat ulozeni obrazku
|
||||||
|
# TODO presmerovani na nove vytvořenou galerii
|
||||||
|
|
||||||
|
else:
|
||||||
|
form = NewGalerieForm()
|
||||||
|
|
||||||
return render(request, 'galerie/GalerieNew.html',
|
return render(request, 'galerie/GalerieNew.html',
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue