from django.contrib.syndication.views import Feed
from django.core.urlresolvers import reverse
from blog.models import Post

class PostFeed(Feed):
	title = "Mark Winter"
	description = "Latest blog posts"

	def link(self):
		return "https://markwinter.me/"

	def feed_url(self):
		return "https://markwinter.me/feed/"

	def items(self):
		return Post.objects.filter(published=True).order_by('-created')[:10]

	def item_title(self, item):
		return item.title

	def item_description(self, item):
		return ""

	def item_pubdate(self, item):
		return item.created

	def item_link(self, item):
		return "https://markwinter.me/" + item.slug
