feat: Add about page

This commit is contained in:
moanos [he/him] 2024-03-18 16:41:22 +01:00
parent ded1aa77cf
commit ee5638d97c
5 changed files with 25 additions and 4 deletions

View File

@ -31,7 +31,8 @@ dependencies = [
"gunicorn",
"fontawesomefree",
"whitenoise",
"model_bakery"
"model_bakery",
"markdown",
]
dynamic = ["version", "readme"]

View File

@ -0,0 +1,7 @@
{% extends "fellchensammlung/base_generic.html" %}
{% load i18n %}
{% block content %}
<h1>{{ markdown_content.title }}</h1>
<p>{{ markdown_content.content|safe }}</p>
{% endblock %}

View File

@ -9,8 +9,8 @@
<nav id="nav" class="nav justify-content-center">
<a class="nav-link nav-link-active" href="/"><i data-feather="home"></i> Home</a>
<a class="nav-link " href="{% url "search" %}"><i class="fas fa-search"></i> Suchen</a>
<a class="nav-link " href="/vermitteln/"><i class="fas fa-"></i> Vermitteln</a>
<a class="nav-link " href="/ueber-uns/"><i class="fas fa-info"></i> Über uns</a>
<a class="nav-link " href="{% url "add-adoption" %}"><i class="fas fa-"></i> Vermitteln</a>
<a class="nav-link " href="{% url "about" %}"><i class="fas fa-info"></i> Über uns</a>
<a class="nav-link " href=""><i class="fas fa-feather"></i> RSS</a>
</nav>

View File

@ -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"),
]

View File

@ -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
)