fix: about

This commit is contained in:
moanos [he/him] 2024-04-14 14:39:49 +02:00
parent 11d5e2a9ee
commit 4ee32607b6
2 changed files with 19 additions and 22 deletions

View File

@ -5,18 +5,19 @@
{% block content %}
<h1>{% translate "Regeln" %}</h1>
{% include "fellchensammlung/lists/list-rules.html" %}
{% if privacy_statement %}
<h1>{{ privacy_statement.title }}</h1>
<p>{{ privacy.content | render_markdown }}</p>
<h1>{{ privacy_statement.title }}</h1>
{{ privacy.content | render_markdown }}
{% endif %}
{% if terms_of_service %}
<h1>{{ terms_of_service.title }}</h1>
<p>{{ terms_of_service.content | render_markdown }}</p>
<h1>{{ terms_of_service.title }}</h1>
{{ terms_of_service.content | render_markdown }}
{% endif %}
{% if imprint %}
<h1>{{ imprint.title }}</h1>
<p>{{ imprint.content | render_markdown }}</p>
<h1>{{ imprint.title }}</h1>
{{ imprint.content | render_markdown }}
{% endif %}
{% endblock %}

View File

@ -99,27 +99,23 @@ def add_animal_to_adoption(request, adoption_notice_id):
def about(request):
rules = Rule.objects.all()
if request.user.is_authenticated:
lang = request.user.member.preferred_language
if lang is None:
lang = Language.objects.get(languagecode="de")
else:
lang = Language.objects.get(languagecode="de")
try:
terms_of_service = Text.objects.get(text_code="terms_of_service", language=lang)
except Text.DoesNotExist:
terms_of_service = None
try:
imprint = Text.objects.get(text_code="imprint", language=lang)
except Text.DoesNotExist:
imprint = None
try:
privacy_statement = Text.objects.get(text_code="privacy_statement", language=lang)
except Text.DoesNotExist:
privacy_statement = None
context = {"rules": rules,
"terms_of_service": terms_of_service,
"imprint": imprint,
"privacy_statement": privacy_statement}
legal = {}
for text_code in ["terms_of_service", "privacy_statement", "imprint"]:
try:
legal[text_code] = Text.objects.get(text_code=text_code, language=lang,)
except Text.DoesNotExist:
legal[text_code] = None
context = {"rules": rules,}
context.update(legal)
return render(
request,
"fellchensammlung/about.html",