Post Comments Feed
Posted on July 19, 2010On my previous post, Holly Jahangiri left me a comment to saying that I need to give commenters the ability to subscribe to future links. I did this with an RSS feed for now, so you can subscribe to any comment links with your feed reader.
I'll add an email subscription later and generally clean it up. For now it actually was harder than I thought (or I was more stupid than I thought) to get the RSS version working.
If you care, here is the feed class I wrote
class CommentFeed(Feed):
title = "Sandcurves.com blog comment feed"
link = "/"
description = "Vernon Swanepoel's personal blog, with topics ranging from programming to birding"
def get_object(self, request, sl):
return get_object_or_404(Post, pk=sl)
def items(self, obj):
return Comment.objects.for_model(obj).filter(is_public=True).order_by('-submit_date')
def title(self, obj):
return "Comments posted on the entry %s" % (obj.title)
def link(self, obj):
if not obj:
raise FeedDoesNotExist
return obj.get_absolute_url()
def description(self, obj):
return "Comments posted on the entry %s" % obj.title