set only the pinned post if there is one to pin.
This commit is contained in:
@@ -18,13 +18,7 @@ def index(request):
|
|||||||
|
|
||||||
# set the pinned post
|
# set the pinned post
|
||||||
featured_post = Post.articles.get_pinned_article()
|
featured_post = Post.articles.get_pinned_article()
|
||||||
if not featured_post:
|
if 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:
|
|
||||||
# remove the pinned post
|
# remove the pinned post
|
||||||
posts.remove(featured_post)
|
posts.remove(featured_post)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user