]> git.sommitrealweird.co.uk Git - sommitrealweird.git/commitdiff
Only use live items in the rss/atom blog feed
authorBrett Parker <iDunno@sommitrealweird.co.uk>
Mon, 11 Jun 2012 10:34:32 +0000 (11:34 +0100)
committerBrett Parker <iDunno@sommitrealweird.co.uk>
Mon, 11 Jun 2012 10:34:32 +0000 (11:34 +0100)
    - Add a filter to check that islive is set to true for blog entries, and
      only display them if that is the case.

sommitrealweird/blog/feeds.py

index 69eb81fe346d323dacb11add90740623ae66e7e4..064f22a5c4671c2b8e63730c28a1e6a9b39f21d0 100644 (file)
@@ -13,9 +13,9 @@ class LatestBlogEntriesRss(Feed):
 
     def items(self):
         try:
-            return BlogEntry.objects.all().order_by('-publish_date')[:20]
+            return BlogEntry.objects.filter(islive=True).order_by('-publish_date')[:20]
         except:
-            return BlogEntry.objects.all().order_by('-publish_date')
+            return BlogEntry.objects.filter(islive=True).order_by('-publish_date')
 
     def author_name(self, obj):
         return "Brett Parker"