Ticket #29418: feeds.py

File feeds.py, 658 bytes (added by BeshoyFarag, 6 years ago)

feeds.py

Line 
1from django.contrib.syndication.views import Feed
2from blog.models import Post
3from django.utils.feedgenerator import Atom1Feed
4
5class RssSiteNewsFeed(Feed):
6 title = "blog rss "
7 link = "/blog/rss/"
8 description = "blog rss and atom feeds ."
9
10 def items(self):
11 return Post.objects.order_by('date')[:10]
12
13 def item_title(self, item):
14 return item.title
15
16 def item_description(self, item):
17 return item.description
18
19 def item_link(self, item):
20 return item.get_absolute_url()
21
22class AtomSiteNewsFeed(RssSiteNewsFeed):
23 feed_type = Atom1Feed
24 subtitle = RssSiteNewsFeed.description
Back to Top