from django.shortcuts import render from django.http import HttpResponse from django.forms import ModelForm from django.http import Http404 from pruefungsamt.models import * def show_homepage(request): return render(request, 'pruefungsamt_basis.html', {}) def show_dozenten_anzahl(request): d = dict( anzahl = Professor.objects.count(), ) return render(request, 'show_dozenten_anzahl.html', d) def list_vls(request): # Zeige Liste aller Vorlesungen an vls = Vorlesung.objects.all() return render(request, 'vls_list.html', dict(vls=vls) ) def show_vl(request, id): # Zeige die Vorlesung mit der id an try: vl = Vorlesung.objects.get(id=id) except Vorlesung.DoesNotExist: raise Http404 return render(request, 'vl.html', dict(vl=vl) ) def list_profs(request): # Zeige Liste aller Professoren an profs = Professor.objects.all() return render(request, 'profs_list.html', dict(profs=profs) ) def show_prof(request, id): # Zeige den Professor mit der id an try: prof = Professor.objects.get(id=id) except Professor.DoesNotExist: raise Http404 return render(request, 'prof.html', dict(prof=prof) ) class VorlesungForm(ModelForm): class Meta: model = Vorlesung fields = ('titel', 'dozent',) # exclude = ()