diff options
author | Dan McGee <dan@archlinux.org> | 2011-02-15 13:49:20 -0600 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-02-15 13:51:11 -0600 |
commit | 8c5358e88898c4eb620a132133c57a26f191dee1 (patch) | |
tree | bc462c1f937a34e7593a92ef3136a34a0ebb85b0 /feeds.py | |
parent | f1e476373a602327a5d23d2f92c7dc30ce2891fd (diff) |
Use date from model in news feed
Now that this a datetime and not just a date, we can use it directly.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'feeds.py')
-rw-r--r-- | feeds.py | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -62,7 +62,8 @@ class PackageFeed(Feed): def get_object(self, request, arch='', repo=''): obj = dict() - qs = Package.objects.select_related('arch', 'repo').order_by('-last_update') + qs = Package.objects.select_related('arch', 'repo').order_by( + '-last_update') if arch != '': # feed for a single arch, also include 'any' packages everywhere @@ -142,11 +143,11 @@ class NewsFeed(Feed): return wrapper(super(NewsFeed, self).__call__)(request, *args, **kwargs) def items(self): - return News.objects.select_related('author').order_by('-postdate', '-id')[:10] + return News.objects.select_related('author').order_by( + '-postdate', '-id')[:10] def item_pubdate(self, item): - d = item.postdate - return datetime.datetime(d.year, d.month, d.day) + return item.postdate def item_author_name(self, item): return item.author.get_full_name() |