1 from django.shortcuts import get_object_or_404, render
2 from django.http import HttpResponse
3 from .models import Animal
7 animals = Animal.objects.all()
8 return render(request, 'animals/list.html', {'animals': animals})
11 def detail(request, animal_name):
12 # return HttpResponse("Hello, world. You're at the animal {}.".format(animal_id))
13 animal = get_object_or_404(Animal, name_german=animal_name)
15 return render(request, 'animals/detail.html', {'animal': animal})