You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

88 lines
1.3 KiB

from django.shortcuts import render, redirect
from django.urls import reverse
from akce.forms import Formular
from akce.models import Akce, Kino, Klub
from kolotoc.models import Kolotoc
from django.http import HttpResponse
from django.template import loader
def kino(request):
template = loader.get_template('akce/kino.html')
dotazy = Kino.objects.all()
context = {
"dotazy": dotazy,
}
return HttpResponse(template.render(context, request))
def akce(request):
template = loader.get_template('akce/akce.html')
dotazy = Akce.objects.all()
context = {
"dotazy": dotazy,
}
return HttpResponse(template.render(context, request))
def klub(request):
template = loader.get_template('akce/klub.html')
dotazy = Klub.objects.all()
context = {
"dotazy": dotazy,
}
return HttpResponse(template.render(context, request))
def form(request):
if request.method == "POST":
form = Formular(request.POST,request.FILES)
if form.is_valid():
form.save()
return redirect(reverse('index'))
else:
form = Formular()
context = {
"form": form,
}
return render(request, "akce/formular_akce.html",context)