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 443bb1e4b3
commit bf9429ace7

View File

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