set only the pinned post if there is one to pin.
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user