New RSS/Atom framework

Posted by Adrian Holovaty on November 11, 2005

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!

Back to Top