set only the pinned post if there is one to pin.

This commit is contained in:
2022-01-20 12:33:19 +00:00
parent e57d575564
commit 74c9c7db8e

View File

@@ -18,13 +18,7 @@ def index(request):
# set the pinned post
featured_post = Post.articles.get_pinned_article()
if not featured_post:
# if a pinned post does not exist, take the last published one.
if len(posts) >= 1:
featured_post = posts.popleft()
else:
featured_post = 0
else:
if featured_post:
# remove the pinned post
posts.remove(featured_post)