2024-03-17 10:26:32 +00:00
|
|
|
from django.shortcuts import render
|
2024-03-18 15:41:22 +00:00
|
|
|
import markdown
|
2024-03-17 10:26:32 +00:00
|
|
|
|
|
|
|
from django.http import HttpResponse
|
2024-03-18 15:41:22 +00:00
|
|
|
from fellchensammlung.models import AdoptionNotice, MarkdownContent
|
2024-03-17 10:26:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
def index(request):
|
2024-03-18 13:53:31 +00:00
|
|
|
"""View function for home page of site."""
|
2024-03-18 13:21:42 +00:00
|
|
|
latest_adoption_list = AdoptionNotice.objects.order_by("-created_at")[:5]
|
2024-03-18 13:53:31 +00:00
|
|
|
context = {"latest_adoptions": latest_adoption_list}
|
|
|
|
|
|
|
|
return render(request, 'fellchensammlung/index.html', context=context)
|
2024-03-18 07:26:21 +00:00
|
|
|
|
|
|
|
|
|
|
|
def adoption_notice_detail(request, adoption_notice_id):
|
|
|
|
return HttpResponse("You're looking at adoption notice %s." % adoption_notice_id)
|
|
|
|
|
|
|
|
|
|
|
|
def animal_detail(request, animal_id):
|
|
|
|
response = "You're looking at animal %s."
|
|
|
|
return HttpResponse(response % animal_id)
|
2024-03-18 15:36:45 +00:00
|
|
|
|
|
|
|
def search(request):
|
|
|
|
return render(request, 'fellchensammlung/search.html')
|
|
|
|
def add_adoption(request):
|
|
|
|
return render(request, 'fellchensammlung/add_adoption.html')
|
|
|
|
|
2024-03-18 15:41:22 +00:00
|
|
|
def about(request):
|
|
|
|
md = markdown.Markdown(extensions=["fenced_code"])
|
|
|
|
markdown_content = MarkdownContent.objects.first()
|
|
|
|
markdown_content.content = md.convert(markdown_content.content)
|
|
|
|
context = {"markdown_content": markdown_content}
|
|
|
|
return render(
|
|
|
|
request,
|
|
|
|
"fellchensammlung/about.html",
|
|
|
|
context=context
|
|
|
|
)
|
|
|
|
|