Permalink
Browse files

bth: fixing news feed

  • Loading branch information...
benthuffine committed Dec 22, 2011
1 parent 571fc9a commit ec027722dbf7429ed803a1dc2d2ff458db07832b
Showing with 4 additions and 2 deletions.
  1. +4 −2 apps/content/feeds.py
View
@@ -2,13 +2,15 @@
from django.contrib.syndication.views import Feed
from neighborlink.apps.content.models import *
+from datetime import datetime
+
class LatestNewsEventsFeed(Feed):
title = "%s News and Events" % settings.SITE_NAME
link = "/news-and-events/"
description = "Latest news and events for %s" % settings.SITE_NAME
def items(self):
- return NewsEvent.objects.order_by('-insert_date')[:5]
+ return NewsEvent.objects.filter(start_date__lte=datetime.now(), end_date__gte=datetime.now(), approved=True).order_by('-event_start_date')[:5]
def item_title(self, item):
return item.title
@@ -22,7 +24,7 @@ class LatestAboutPageFeed(Feed):
description = "Latest articles for %s" % settings.SITE_NAME
def items(self):
- return AboutPage.objects.order_by('-insert_date')[:5]
+ return AboutPage.objects.filter(approved=True).order_by('-insert_date')[:5]
def item_title(self, item):
return item.title

0 comments on commit ec02772

Please sign in to comment.