diff --git a/files/classes/comment.py b/files/classes/comment.py index 1b07a89ce..af249bacb 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -319,7 +319,7 @@ class Comment(Base): @property @lazy def author_name(self): - if self.ghost and not (g.v and self.id == g.v.id): return '👻' + if self.ghost and not (hasattr(g, 'v') and g.v and self.id == g.v.id): return '👻' return self.author.user_name @lazy diff --git a/files/classes/post.py b/files/classes/post.py index 352e3b9be..3db1b9a41 100644 --- a/files/classes/post.py +++ b/files/classes/post.py @@ -156,7 +156,7 @@ class Post(Base): @property @lazy def author_name(self): - if self.ghost and not (g.v and self.id == g.v.id): return '👻' + if self.ghost and not (hasattr(g, 'v') and g.v and self.id == g.v.id): return '👻' return self.author.user_name @property