feat: Allow new custom texts
This commit is contained in:
parent
739418feb6
commit
ac139af706
13
README.md
13
README.md
@ -39,6 +39,19 @@ Query location data to debug
|
||||
nf query_location <query>
|
||||
```
|
||||
|
||||
# Texts
|
||||
|
||||
There is a system for customizing texts in Notfellchen. Not every change of a tet should mean an update of the software. But this should also not become a CMS.
|
||||
Therefore, a solution is used where a number of predefined texts per site are supported. These markdown texts will then be included in the site, if defined.
|
||||
|
||||
| Textcode | Location |
|
||||
|---------------------|----------|
|
||||
| `how_to` | Index |
|
||||
| `introduction` | Index |
|
||||
| `privacy_statement` | About |
|
||||
| `terms_of_service` | About |
|
||||
| `imprint` | About |
|
||||
| Any rule | About |
|
||||
|
||||
# Developer Notes
|
||||
|
||||
|
@ -1,15 +1,23 @@
|
||||
{% extends "fellchensammlung/base_generic.html" %}
|
||||
{% load i18n %}
|
||||
{% load custom_tags %}
|
||||
|
||||
{% block content %}
|
||||
{% for announcement in announcements %}
|
||||
{% include "fellchensammlung/partials/partial-announcement.html" %}
|
||||
{% endfor %}
|
||||
<h1>{% translate "Notfellchen - Vermittlungen finden" %}</h1>
|
||||
<p>{% translate "Alle Tiere brauchen ein liebendes Zuhause. Damit keins vergessen wird gibt es diese Seite. Entwickelt und betreut von " %}<em><a
|
||||
href="https://hyteck.de">moanos</a></em>!</p>
|
||||
{% if introduction %}
|
||||
<h1>{{ introduction.title }}</h1>
|
||||
{{ introduction.content | render_markdown }}
|
||||
{% endif %}
|
||||
|
||||
<h2>{% translate "Aktuelle Vermittlungen" %}</h2>
|
||||
|
||||
{% include "fellchensammlung/lists/list-adoption-notices.html" %}
|
||||
|
||||
{% if how_to %}
|
||||
<h1>{{ how_to.title }}</h1>
|
||||
{{ how_to.content | render_markdown }}
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
@ -43,7 +43,13 @@ def index(request):
|
||||
language_code = translation.get_language()
|
||||
lang = Language.objects.get(languagecode=language_code)
|
||||
active_announcements = Announcement.get_active_announcements(lang)
|
||||
|
||||
context = {"adoption_notices": active_adoptions, "announcements": active_announcements}
|
||||
for text_code in ["how_to", "introduction"]:
|
||||
try:
|
||||
context[text_code] = Text.objects.get(text_code=text_code, language=lang, )
|
||||
except Text.DoesNotExist:
|
||||
context[text_code] = None
|
||||
|
||||
return render(request, 'fellchensammlung/index.html', context=context)
|
||||
|
||||
@ -96,7 +102,8 @@ def adoption_notice_detail(request, adoption_notice_id):
|
||||
raise PermissionDenied
|
||||
else:
|
||||
comment_form = CommentForm(instance=adoption_notice)
|
||||
context = {"adoption_notice": adoption_notice, "comment_form": comment_form, "user": request.user, "has_edit_permission": has_edit_permission}
|
||||
context = {"adoption_notice": adoption_notice, "comment_form": comment_form, "user": request.user,
|
||||
"has_edit_permission": has_edit_permission}
|
||||
return render(request, 'fellchensammlung/details/detail_adoption_notice.html', context=context)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user