From e24c208e1d3f9d4b5834b1095dac09273106acf2 Mon Sep 17 00:00:00 2001 From: cuom1999 Date: Tue, 23 Apr 2024 15:53:58 -0500 Subject: [PATCH] Fix None bug --- judge/views/blog.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/judge/views/blog.py b/judge/views/blog.py index 4485114..c6421b7 100644 --- a/judge/views/blog.py +++ b/judge/views/blog.py @@ -187,14 +187,16 @@ class PostView(TitleMixin, CommentedDetailView, PageVoteDetailView, BookMarkDeta context["editable_orgs"] = [] can_edit = False - if self.request.profile.id in self.object.get_authors(): - can_edit = True - orgs = list(self.object.organizations.all()) - for org in orgs: - if org.is_admin(self.request.profile): + + if self.request.profile: + if self.request.profile.id in self.object.get_authors(): can_edit = True + for org in orgs: + if org.is_admin(self.request.profile): + can_edit = True + if can_edit: for org in orgs: if org.is_member(self.request.profile):