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 %} {% block content %}
<h1>{% translate "Regeln" %}</h1> <h1>{% translate "Regeln" %}</h1>
{% include "fellchensammlung/lists/list-rules.html" %} {% include "fellchensammlung/lists/list-rules.html" %}
{% if privacy_statement %} {% if privacy_statement %}
<h1>{{ privacy_statement.title }}</h1> <h1>{{ privacy_statement.title }}</h1>
<p>{{ privacy.content | render_markdown }}</p> {{ privacy.content | render_markdown }}
{% endif %} {% endif %}
{% if terms_of_service %} {% if terms_of_service %}
<h1>{{ terms_of_service.title }}</h1> <h1>{{ terms_of_service.title }}</h1>
<p>{{ terms_of_service.content | render_markdown }}</p> {{ terms_of_service.content | render_markdown }}
{% endif %} {% endif %}
{% if imprint %} {% if imprint %}
<h1>{{ imprint.title }}</h1> <h1>{{ imprint.title }}</h1>
<p>{{ imprint.content | render_markdown }}</p> {{ imprint.content | render_markdown }}
{% endif %} {% endif %}
{% endblock %} {% endblock %}

View File

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