#coding=utf-8 from django.contrib.syndication.feeds import Feed from django.utils.feedgenerator import Atom1Feed from django.contrib.sites.models import Site from blog.models import Post current_site = Site.objects.get_current().name class LatestPostFeed(Feed): """ Feed of the most recently published Snippets. """ #feed_type = Atom1Feed title_template = 'feeds/title.html' description_template = 'feeds/description.html' item_copyright = 'www.maplye.com' title = "%s: Latest posts" % current_site link = "/snippets/" description = "Latest posts" author = "maplye" def item_author_name(self, item): return item.author def items(self): return Post.objects.all()[:50] def item_link(self, item): return item.get_absolute_url() def item_pubdate(self, item): return item.date