feat: Add animal detail view

This commit is contained in:
2024-03-19 06:15:38 +01:00
parent 029e974079
commit bc9df3ba8b
3 changed files with 52 additions and 10 deletions

View File

@@ -2,7 +2,7 @@ from django.shortcuts import render
import markdown
from django.http import HttpResponse
from fellchensammlung.models import AdoptionNotice, MarkdownContent
from fellchensammlung.models import AdoptionNotice, MarkdownContent, Animal
def index(request):
@@ -18,8 +18,9 @@ def adoption_notice_detail(request, adoption_notice_id):
def animal_detail(request, animal_id):
response = "You're looking at animal %s."
return HttpResponse(response % animal_id)
animal = Animal.objects.get(id=animal_id)
context = {"animal": animal}
return render(request, 'fellchensammlung/detail_animal.html', context=context)
def search(request):
latest_adoption_list = AdoptionNotice.objects.order_by("-created_at")[:5]