From a306094530a5e49a758cd9cf02d8860437c2dd8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yaroslav=20de=20la=20Pe=C3=B1a?= Date: Fri, 12 Oct 2018 16:33:43 +0300 Subject: fixed pinned posts appearing even if they are not published yet --- weblog/views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'weblog/views.py') diff --git a/weblog/views.py b/weblog/views.py index d3a7066..d614cd6 100755 --- a/weblog/views.py +++ b/weblog/views.py @@ -78,7 +78,7 @@ def Index(request, **kwargs): # and get the pinned and necessary posts depending on the page posts_raw = list(all_pages[slice_start:slice_end]) if len(kwargs) < 1: - for pinned_post in BlogPost.objects.filter(pinned=True).order_by('-pin_priority'): + for pinned_post in BlogPost.objects.filter(published=True, pinned=True).order_by('-pin_priority'): if pinned_post in posts_raw: posts_raw.remove(pinned_post) posts_raw.append(pinned_post) @@ -155,6 +155,7 @@ def Index(request, **kwargs): else: posts.append(post) + print('rendering template') # If ajax is asking for the next page through the kwargs, # just send the posts for the requested page without the other page elements if 'nxtpage' in kwargs: -- cgit v1.2.3