feat: Allow undefined texts

This commit is contained in:
moanos [he/him] 2024-04-14 13:37:51 +02:00
parent 505b2255cc
commit 2d86292d66

View File

@ -103,9 +103,16 @@ def about(request):
lang = request.user.member.preferred_language lang = request.user.member.preferred_language
else: else:
lang = Language.objects.get(languagecode="de") lang = Language.objects.get(languagecode="de")
terms_of_service = Text.objects.get(text_code="terms_of_service", language=lang) try:
imprint = Text.objects.get(text_code="imprint", language=lang) terms_of_service = Text.objects.get(text_code="terms_of_service", language=lang)
context = {"rules": rules} except Text.DoesNotExist:
terms_of_service = None
try:
imprint = Text.objects.get(text_code="imprint", language=lang)
except Text.DoesNotExist:
imprint = None
context = {"rules": rules, "terms_of_service": terms_of_service, "imprint": imprint}
return render( return render(
request, request,
"fellchensammlung/about.html", "fellchensammlung/about.html",