views:

40

answers:

0

Hi all,

I'm following the documentation at http://docs.djangoproject.com/en/1.2/ref/contrib/syndication/ quite closely, but I keep getting AttributeError: object has no attribute 'rindex' when implementing the following.

urls.py:

from django.conf.urls.defaults import *
from feedcreator.feeds import FeedPosts

urlpatterns += patterns('',
    (r'^feeds/(?P<feed_id>\d+)/?$', FeedPosts()),
)

feeds.py

from django.contrib.syndication.views import Feed
from django.shortcuts import get_object_or_404
from feedcreator.models import Feed, Post

class FeedPosts(Feed):
    title = 'my feed'
    description = 'mydesc'
    description_template = 'feedcreator/templates/feedtemplate.html'

    def get_object(self, request, feed_id):
        return get_object_or_404(Feed, pk=feed_id)

    def items(self, obj):
        return Post.objects.filter(feed=obj).order_by('-publish_at')[0:10]

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

    def item_description(self, obj):
        return obj.description

Django version is 1.2.3, and the full traceback is available at http://dpaste.com/262855/ if required. Thanks in advance.