Further play with django from last week.
[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_id):
11     # return HttpResponse("Hello, world. You're at the animal {}.".format(animal_id))
12     animal = get_object_or_404(Animal, pk=animal_id)
13     return render(request, 'animals/detail.html', {'animal': animal})