blob: 8aeaf32f663ef7e7b3f850d90236e1270573bb8a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
from django.contrib.syndication.views import Feed
from models import NewsArticle
from datetime import datetime, time
class NewsFeed(Feed):
title = description = "PostgreSQL news"
link = "https://www.postgresql.org/"
description_template = 'news/rss_description.html'
title_template = 'news/rss_title.html'
def items(self):
return NewsArticle.objects.filter(approved=True)[:10]
def item_link(self, obj):
return "https://www.postgresql.org/about/news/%s/" % obj.id
def item_pubdate(self, obj):
return datetime.combine(obj.date,time.min)
|