-
Book Overview & Buying
-
Table Of Contents
Mastering Django: Core
By :
The high-level feed-generating framework is supplied by the Feed class. To create a feed, write a Feed class and point to an instance of it in your URLconf.
A Feed class is a Python class that represents a syndication feed. A feed can be simple (for example, a site news feed, or a basic feed displaying the latest entries of a blog) or more complex (for example, a feed displaying all the blog entries in a particular category, where the category is variable). Feed classes subclass django.contrib.syndication.views.Feed. They can live anywhere in your codebase. Instances of Feed classes are views which can be used in your URLconf.
This simple example, taken from a hypothetical police beat news site describes a feed of the latest five news items:
from django.contrib.syndication.views import Feed
from django.core.urlresolvers import reverse
from policebeat.models import NewsItem
class LatestEntriesFeed(Feed):
title = "Police...
Change the font size
Change margin width
Change background colour