Skip to content

Instantly share code, notes, and snippets.

@jsmoxon
Created June 9, 2012 19:11
Show Gist options
  • Save jsmoxon/2902214 to your computer and use it in GitHub Desktop.
Save jsmoxon/2902214 to your computer and use it in GitHub Desktop.
Feeds.py for Django RSS
from django.contrib.syndication.views import Feed
from models import *
class LatestPosts(Feed):
title = "Your Blog"
link = "http://www.yourdomain.com/blog/"
description = "Latest blog posts..."
def items(self):
return Post.objects.order_by('-published_date')[:50]
def item_title(self, item):
return item.title
def item_description(self, item):
return item.description
def item_link(self, item):
return "http://yourdomain.com/blog/<path_to_post>/"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment