diff --git a/pyproject.toml b/pyproject.toml index 6b3db5a..3832c71 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,7 +31,8 @@ dependencies = [ "gunicorn", "fontawesomefree", "whitenoise", - "model_bakery" + "model_bakery", + "markdown", ] dynamic = ["version", "readme"] diff --git a/src/fellchensammlung/templates/fellchensammlung/about.html b/src/fellchensammlung/templates/fellchensammlung/about.html new file mode 100644 index 0000000..35b2e63 --- /dev/null +++ b/src/fellchensammlung/templates/fellchensammlung/about.html @@ -0,0 +1,7 @@ +{% extends "fellchensammlung/base_generic.html" %} +{% load i18n %} + +{% block content %} +

{{ markdown_content.title }}

+

{{ markdown_content.content|safe }}

+{% endblock %} \ No newline at end of file diff --git a/src/fellchensammlung/templates/fellchensammlung/header.html b/src/fellchensammlung/templates/fellchensammlung/header.html index f3d2b34..c6fad86 100644 --- a/src/fellchensammlung/templates/fellchensammlung/header.html +++ b/src/fellchensammlung/templates/fellchensammlung/header.html @@ -9,8 +9,8 @@ diff --git a/src/fellchensammlung/urls.py b/src/fellchensammlung/urls.py index bd350fc..bdf7b43 100644 --- a/src/fellchensammlung/urls.py +++ b/src/fellchensammlung/urls.py @@ -13,4 +13,5 @@ urlpatterns = [ path("suchen/", views.search, name="search"), # ex: /vermitteln/ path("vermitteln/", views.add_adoption, name="add-adoption"), + path("ueber-uns/", views.about, name="about"), ] \ No newline at end of file diff --git a/src/fellchensammlung/views.py b/src/fellchensammlung/views.py index c8d7f8c..400f17c 100644 --- a/src/fellchensammlung/views.py +++ b/src/fellchensammlung/views.py @@ -1,7 +1,8 @@ from django.shortcuts import render +import markdown from django.http import HttpResponse -from fellchensammlung.models import AdoptionNotice +from fellchensammlung.models import AdoptionNotice, MarkdownContent def index(request): @@ -25,3 +26,14 @@ def search(request): def add_adoption(request): return render(request, 'fellchensammlung/add_adoption.html') +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 + ) +