galerie | navrh formulare pro vytvareni nove galerie
This commit is contained in:
parent
9180dc32ca
commit
5e9c6bfe58
5 changed files with 33 additions and 3 deletions
|
@ -5,8 +5,6 @@
|
|||
* zvolit velikosti velke a male fotky
|
||||
* vycteni EXIFu
|
||||
* razeni podle casu
|
||||
* uprava templatu (detail)
|
||||
* hromadne nahravani fotek
|
||||
* psani komentaru
|
||||
* do CSS
|
||||
* znovuukladani malych a strednich fotek -- spravit, aby se tak nedělo furt
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
#coding: utf-8
|
||||
|
||||
from django import forms
|
||||
from seminar.models import Soustredeni
|
||||
|
||||
class KomentarForm(forms.Form):
|
||||
komentar = forms.CharField(label = "Komentář:", max_length = 300, required=False)
|
||||
|
||||
class NewGalerieForm(forms.Form):
|
||||
soustredeni = forms.ModelChoiceField(queryset = Soustredeni.objects, label = "Soustředění")
|
||||
nazev = forms.CharField(label = "Název galerie", max_length = 100)
|
||||
|
|
18
galerie/templates/galerie/GalerieNew.html
Normal file
18
galerie/templates/galerie/GalerieNew.html
Normal file
|
@ -0,0 +1,18 @@
|
|||
{% extends "galerie/Base.html" %}
|
||||
|
||||
{% block title %}{% block nadpis1a %}
|
||||
Vytvářím novou galerii
|
||||
{% endblock %}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<form enctype="multipart/form-data" action="." method="post">
|
||||
{% csrf_token %}
|
||||
<table>{{form.as_table}}
|
||||
<tr><td><label>Obrázky:</label></td><td><input name="obr" type="file" multiple></td></tr>
|
||||
<tr><td> </td></tr>
|
||||
<tr><td></td><td><input name="odeslat" type="submit" value="Vytvoř galerii"></td></tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
{% endblock %}
|
|
@ -5,5 +5,6 @@ from django.conf.urls import patterns, include, url
|
|||
urlpatterns = patterns('',
|
||||
(r'^(?P<pk>\d+)/$', 'galerie.views.nahled'),
|
||||
(r'^(?P<pk>\d+)/(?P<fotka>\d+)/$', 'galerie.views.detail'),
|
||||
(r'^(?P<galerie>\d+)/new/$', 'galerie.views.new_galerie'),
|
||||
)
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ from django.template import RequestContext
|
|||
from galerie.models import Obrazek, Galerie
|
||||
from seminar.models import Soustredeni
|
||||
|
||||
from galerie.forms import KomentarForm
|
||||
from galerie.forms import KomentarForm, NewGalerieForm
|
||||
|
||||
|
||||
#def index(request, stitek=None):
|
||||
|
@ -107,3 +107,11 @@ def detail(request, pk, fotka, soustredeni):
|
|||
'form' : form,
|
||||
})
|
||||
|
||||
|
||||
def new_galerie(request, galerie, soustredeni):
|
||||
form = NewGalerieForm()
|
||||
|
||||
return render(request, 'galerie/GalerieNew.html',
|
||||
{
|
||||
'form' : form,
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue