From 74c9c7db8e000d1724cdbe3a777dfd83d338edd9 Mon Sep 17 00:00:00 2001 From: Patrick Mayr Date: Thu, 20 Jan 2022 12:33:19 +0000 Subject: [PATCH] set only the pinned post if there is one to pin. --- fet2020/fet2020/views.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/fet2020/fet2020/views.py b/fet2020/fet2020/views.py index f5d8bc79..37832cc6 100644 --- a/fet2020/fet2020/views.py +++ b/fet2020/fet2020/views.py @@ -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)