From 734560379ba28c92b35f41bdde0f5973ef795a38 Mon Sep 17 00:00:00 2001 From: Ishaan Mittal Date: Fri, 30 Aug 2024 09:45:29 +0530 Subject: [PATCH] profile fix (#77) Co-authored-by: Ishaan Mittal --- home/views.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/home/views.py b/home/views.py index 58d4ba9..d1f962b 100644 --- a/home/views.py +++ b/home/views.py @@ -470,9 +470,11 @@ def profile(request): ) picture = "not available" allocation: Allocation | None = Allocation.objects.filter(email=student).last() - show_allocated_enabled = AllocationForm.objects.filter( - show_allocated=True, period=allocation.period - ).exists() + show_allocated_enabled = False + if allocation and allocation.period: + show_allocated_enabled = AllocationForm.objects.filter( + show_allocated=True, period=allocation.period + ).exists() allocation_info = {} # improve this alignment of text to be shown on the profile section if allocation and show_allocated_enabled: