From 2d86292d66d0d0d9aff0e8caec1ae2453c524339 Mon Sep 17 00:00:00 2001 From: moanos Date: Sun, 14 Apr 2024 13:37:51 +0200 Subject: [PATCH] feat: Allow undefined texts --- src/fellchensammlung/views.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/fellchensammlung/views.py b/src/fellchensammlung/views.py index 8aa83ba..eb27d59 100644 --- a/src/fellchensammlung/views.py +++ b/src/fellchensammlung/views.py @@ -103,9 +103,16 @@ def about(request): lang = request.user.member.preferred_language else: lang = Language.objects.get(languagecode="de") - terms_of_service = Text.objects.get(text_code="terms_of_service", language=lang) - imprint = Text.objects.get(text_code="imprint", language=lang) - context = {"rules": rules} + 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 + + context = {"rules": rules, "terms_of_service": terms_of_service, "imprint": imprint} return render( request, "fellchensammlung/about.html",