« Back

Post Comments Feed

« Older Post  |  Newer Post »

    Posted on July 19, 2010     

On 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

« Older Post  |  Newer Post »


If you enjoy reading this blog, please subscribe | You might also like:  Rebuilt Sandcurves Blog App

 

Thank you for visiting

This is my personal blog, but I try to write things that you may find interesting or useful.  I'm currently working on a six month long project digging into the elements that make a blog meaningful. For more on that, visit MEANINGFUL BLOG PROJECT page

You may want to know a little about me personally, so start at the about page. 

If you find some of what is here interesting, or you want to follow the project through, why not subscribe.

Tweet