Following the example at: http://www.djangoproject.com/documentation/syndication_feeds/#a-complex-example
I've arrived at the following:
class BpostCatPosts(Feed):
"""
Shows the latest blog posts from an individual blog post category.
"""
def get_object(self, bits):
# In case of "/feeds/bpcatposts/0613/foo/bar/baz/", or other such clutter,
# check that bits has only one member.
if len(bits) != 1:
raise ObjectDoesNotExist
return BlogCategory.objects.get(id__exact=2)
def title(self, obj):
return "Greg Taylor's Latest: %s" % obj.name
def link(self, obj):
if not obj:
raise FeedDoesNotExist
return obj.get_absolute_url()
def description(self, obj):
return "The latest posts from the %s category of Greg Taylor's blog." % obj.name
def items(self, obj):
return BlogPost.objects.filter(category=[obj.id])[:10]
My feed section of urls.py looks like this:
feeds = {
'latest_bpost': LatestBposts,
'latest_bpostcat': BpostCatPosts,
}
urlpatterns = patterns('',
# Serve Media via Django
(r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
# Default Page
(r'^', include('apps.pages.urls')),
# Standard Pages
(r'^pages/', include('apps.pages.urls')),
# Blog URLs
(r'^blog/', include('apps.blog.urls')),
# Django Admin Interface
(r'^admin/', include('django.contrib.admin.urls')),
# RSS Feeds
(r'^feeds/(?P<url>.*)/$', 'django.contrib.syndication.views.feed', {'feed_dict': feeds}),
)
When visiting the URL http://localhost:8000/feeds/latest_bpostcat/2/ I am getting the following error:
InterfaceError at /feeds/latest_bpostcat/2/
Error binding parameter 0 - probably unsupported type.
I've looked over this quite a few times and can't figure out if the API has changed or if there was an omission. I've tried my best to assure that the error wasn't on my part.