Created
June 9, 2012 19:11
-
-
Save jsmoxon/2902214 to your computer and use it in GitHub Desktop.
Feeds.py for Django RSS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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