Browse Source

galerie | navrh formulare pro vytvareni nove galerie

remotes/origin/Float_novinky
Bc. Petr Pecha 9 years ago
parent
commit
5e9c6bfe58
  1. 2
      galerie/TODO
  2. 5
      galerie/forms.py
  3. 18
      galerie/templates/galerie/GalerieNew.html
  4. 1
      galerie/urls.py
  5. 10
      galerie/views.py

2
galerie/TODO

@ -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

5
galerie/forms.py

@ -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

@ -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>&nbsp;</td></tr>
<tr><td></td><td><input name="odeslat" type="submit" value="Vytvoř galerii"></td></tr>
</table>
</form>
{% endblock %}

1
galerie/urls.py

@ -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'),
)

10
galerie/views.py

@ -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…
Cancel
Save