Skip to content

Commit

Permalink
fix: Fix After publish (blog) page hook
Browse files Browse the repository at this point in the history
  • Loading branch information
drikusroor committed Oct 7, 2024
1 parent d4e2175 commit 073cbb1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/blog/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,12 @@ def get_context(self, request):
context["posts"] = (
self.user.blog_posts.live().filter(date__lte=now).order_by("-date")
)
context["is_subscribed"] = Subscription.objects.filter(
subscriber=request.user, author=self.user
).exists()

if request.user.is_authenticated:
context["is_subscribed"] = Subscription.objects.filter(
subscriber=request.user, author=self.user
).exists()

return context

parent_page_types = ["AuthorIndexPage"]
Expand Down

0 comments on commit 073cbb1

Please sign in to comment.