From 54c0a253f8f2572b978a31630ea11ce75fae1b98 Mon Sep 17 00:00:00 2001 From: George Katsikas <giorgakis.katsikas@gmail.com> Date: Wed, 6 Sep 2023 14:04:40 +0200 Subject: [PATCH] add failsafe to fellowship role processing --- scipost_django/scipost/context_processors.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scipost_django/scipost/context_processors.py b/scipost_django/scipost/context_processors.py index 71c8add38..65bc957b8 100644 --- a/scipost_django/scipost/context_processors.py +++ b/scipost_django/scipost/context_processors.py @@ -41,8 +41,9 @@ def roles_processor(request): ) except active_fellowships.model.DoesNotExist: context["session_fellowship"] = active_fellowships.first() - if context["session_fellowship"].senior: - context["user_roles"].append("active_senior_fellow") + if "session_fellowship" in context: + if getattr(context["session_fellowship"], "senior"): + context["user_roles"].append("active_senior_fellow") except AttributeError: pass return context -- GitLab