summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas NOEL <tnoel@entrouvert.com>2011-04-28 08:17:07 (GMT)
committerThomas NOEL <tnoel@entrouvert.com>2011-04-28 08:17:07 (GMT)
commit24663acdf1169a6946fc268d373ee33e27b4f0f0 (patch)
treecfbbaad90698a8e5d59822b65c5c13769f5b25a0
parentc2188cd97b4eb0ce6a46089d7b161972e6efe1d7 (diff)
downloadsurveillao-24663acdf1169a6946fc268d373ee33e27b4f0f0.zip
surveillao-24663acdf1169a6946fc268d373ee33e27b4f0f0.tar.gz
surveillao-24663acdf1169a6946fc268d373ee33e27b4f0f0.tar.bz2
output feed = items added last 3 days
-rw-r--r--feeds.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/feeds.py b/feeds.py
index a0be0c1..c7be7f8 100644
--- a/feeds.py
+++ b/feeds.py
@@ -2,6 +2,7 @@
from django.contrib.syndication.views import Feed
from base.models import Item
+from datetime import datetime, timedelta
class AoFeed(Feed):
title = "Appels d'offres pour EO"
@@ -10,7 +11,9 @@ class AoFeed(Feed):
ttl = 360
def items(self):
- return Item.objects.order_by('-add_date')[:300]
+ # list items added last 3 days
+ last_add = datetime.now() + timedelta(-3)
+ return Item.objects.filter(add_date__gte=last_add)
def item_title(self, item):
title = '[' + item.source.__unicode__() + '] ' + item.title
@@ -30,5 +33,6 @@ class AoFeedMark(AoFeed):
title = "Appels d'offres MARQUÉS"
def items(self):
- return Item.objects.filter(mark=True).order_by('-add_date')[:300]
+ last_add = datetime.now() + timedelta(-3)
+ return Item.objects.filter(mark=True, add_date__gte=last_add)