New RSS/Atom framework
We've added a syndication framework to Django. It makes generating RSS and Atom feeds very easy.
Man, it's so easy it probably shouldn't even be legal.
"svn update" your code to get access to it, and read all about it at the brand-new syndication-framework docs.
Here's a quick sample. This Python class creates an RSS feed of the latest entries of this weblog:
class LatestEntries(Feed):
title = "The Django weblog"
link = "/weblog/"
description = "Latest news about Django, the Python Web framework."
def items(self):
return entries.get_list(limit=10)
This example is super-simple, but the framework is quite dynamic and allows for significant complexity.
The previous RSS framework, which was completely undocumented, has been removed/refactored completely. If you hacked things around, reverse-engineered, etc., and were actually using the previous RSS framework, your feeds will no longer work. I've documented the changes on the backwards-incompatible changes page.
Thanks to alastair, ismael, hugo, eric moritz and garthk for various patches and ideas. Enjoy!
Posted by Adrian Holovaty on November 11, 2005
Comments
Adrian Holovaty November 12, 2005 at 12:33 p.m.
James: Good call. I've improved it so that each feed sends out either "application/rss+xml" or "application/atom+xml". Thanks for the heads-up!
Comments are closed
To prevent spam, comments are no longer allowed after sixty days.


James November 12, 2005 at 12:29 a.m.
Looking through the code, it appears that the only MIME-type that can be returned for a feed is 'application/xml'; is there something I'm missing which could return (depending on feed type) 'application/rss+xml' or 'application/atom+xml' instead?