Now using "templates" as our template dir name.
[toast/alpenzoo.git] / animals / views.py
index 91ea44a218fbd2f408430959283f0419c921093e..48da423e0d44e397e3f49bcfcda1151a5d1022bc 100644 (file)
@@ -1,3 +1,14 @@
-from django.shortcuts import render
+from django.shortcuts import get_object_or_404, render
+from django.http import HttpResponse
+from .models import Animal
 
 # Create your views here.
+def index(request):
+    return HttpResponse("Hello, world. You're at the animals index.")
+
+
+def detail(request, animal_name):
+    # return HttpResponse("Hello, world. You're at the animal {}.".format(animal_id))
+    animal = get_object_or_404(Animal, name_german=animal_name)
+
+    return render(request, 'animals/detail.html', {'animal': animal})