From 7a178a7f819541a882282bba5658539dd9a0b584 Mon Sep 17 00:00:00 2001 From: Elena Date: Thu, 25 May 2023 19:43:46 -0500 Subject: [PATCH] Update view to handle for logged-in user with null userprofile --- ourchive_app/frontend/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ourchive_app/frontend/views.py b/ourchive_app/frontend/views.py index 1f67c56c..59ad510a 100644 --- a/ourchive_app/frontend/views.py +++ b/ourchive_app/frontend/views.py @@ -95,7 +95,7 @@ def index(request): if request.user.is_authenticated: request_url = f"api/users/{request.user.id}/" response = do_get(request_url, request)[0] - if 'userprofile' in response and response['userprofile']['has_notifications']: + if 'userprofile' in response and response['userprofile'] is not None and 'has_notifications' in response['userprofile']: has_notifications = response['userprofile']['has_notifications'] request.session['has_notifications'] = has_notifications else: