diff --git a/src/fellchensammlung/templates/fellchensammlung/about.html b/src/fellchensammlung/templates/fellchensammlung/about.html
index 9f9fe60..2ae8f78 100644
--- a/src/fellchensammlung/templates/fellchensammlung/about.html
+++ b/src/fellchensammlung/templates/fellchensammlung/about.html
@@ -5,18 +5,19 @@
{% block content %}
{% translate "Regeln" %}
{% include "fellchensammlung/lists/list-rules.html" %}
+
{% if privacy_statement %}
- {{ privacy_statement.title }}
- {{ privacy.content | render_markdown }}
+ {{ privacy_statement.title }}
+ {{ privacy.content | render_markdown }}
{% endif %}
{% if terms_of_service %}
- {{ terms_of_service.title }}
- {{ terms_of_service.content | render_markdown }}
+ {{ terms_of_service.title }}
+ {{ terms_of_service.content | render_markdown }}
{% endif %}
{% if imprint %}
- {{ imprint.title }}
- {{ imprint.content | render_markdown }}
+ {{ imprint.title }}
+ {{ imprint.content | render_markdown }}
{% endif %}
{% endblock %}
\ No newline at end of file
diff --git a/src/fellchensammlung/views.py b/src/fellchensammlung/views.py
index 3636b48..1f884a1 100644
--- a/src/fellchensammlung/views.py
+++ b/src/fellchensammlung/views.py
@@ -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",