48da423e0d44e397e3f49bcfcda1151a5d1022bc
[toast/alpenzoo.git] / animals / views.py
1 from django.shortcuts import get_object_or_404, render
2 from django.http import HttpResponse
3 from .models import Animal
4
5 # Create your views here.
6 def index(request):
7     return HttpResponse("Hello, world. You're at the animals index.")
8
9
10 def detail(request, animal_name):
11     # return HttpResponse("Hello, world. You're at the animal {}.".format(animal_id))
12     animal = get_object_or_404(Animal, name_german=animal_name)
13
14     return render(request, 'animals/detail.html', {'animal': animal})