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.
44 lines
1.2 KiB
44 lines
1.2 KiB
from django.shortcuts import render,redirect,reverse
|
|
from django.http import HttpResponse, HttpResponseNotFound, Http404,HttpResponseRedirect
|
|
|
|
#zeitgeraffel
|
|
from django.utils import timezone
|
|
from django.core.exceptions import ObjectDoesNotExist
|
|
import datetime
|
|
import pytz
|
|
|
|
from hpst.models import Termin
|
|
|
|
# Create your views here.
|
|
def index(request):
|
|
termine=Termin.objects.filter(date__gt=timezone.now()).order_by( 'date')
|
|
context ={
|
|
"termine":termine,
|
|
"data":"Gfg is the best",
|
|
"list":[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
|
}
|
|
# return response with template and context
|
|
return render(request, "index.html", context)
|
|
|
|
def termin(request,tid):
|
|
#print (tid)
|
|
error=""
|
|
try:
|
|
termin=Termin.objects.get(id=tid)
|
|
except ObjectDoesNotExist:
|
|
error="Dieser Termin existiert nicht"
|
|
context ={
|
|
"termin":termin,
|
|
"error":error,
|
|
}
|
|
# return response with template and context
|
|
return render(request, "termin.html", context)
|
|
|
|
def impressum(request):
|
|
error="Kein Impressum"
|
|
context ={
|
|
"termin":termin,
|
|
}
|
|
# return response with template and context
|
|
return render(request, "impressum.html", context)
|
|
|
|
|