From 09d40c508a54e79dc324f62410fac7f34526a1f7 Mon Sep 17 00:00:00 2001 From: Jacob Kaplan-Moss Date: Tue, 7 Nov 2006 01:54:34 +0000 Subject: [PATCH] Fixed #2987: cleaned up the syndication documentation a bit, thanks to dev@simon.net.nz. git-svn-id: http://code.djangoproject.com/svn/django/trunk@4031 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- docs/syndication_feeds.txt | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/docs/syndication_feeds.txt b/docs/syndication_feeds.txt index 225b67eb02..59a9022d9b 100644 --- a/docs/syndication_feeds.txt +++ b/docs/syndication_feeds.txt @@ -95,7 +95,7 @@ latest five news items:: from django.contrib.syndication.feeds import Feed from chicagocrime.models import NewsItem - class SiteNewsFeed(Feed): + class LatestEntries(Feed): title = "Chicagocrime.org site news" link = "/sitenews/" description = "Updates on changes and additions to chicagocrime.org." @@ -120,14 +120,14 @@ One thing's left to do. In an RSS feed, each ```` has a ````, put into those elements. * To specify the contents of ``<title>`` and ``<description>``, create - `Django templates`_ called ``feeds/sitenews_title.html`` and - ``feeds/sitenews_description.html``, where ``sitenews`` is the ``slug`` + `Django templates`_ called ``feeds/latest_title.html`` and + ``feeds/latest_description.html``, where ``latest`` is the ``slug`` specified in the URLconf for the given feed. Note the ``.html`` extension is required. The RSS system renders that template for each item, passing it two template context variables: * ``{{ obj }}`` -- The current object (one of whichever objects you - returned in ``items()``). + returned in ``items()``). * ``{{ site }}`` -- A ``django.models.core.sites.Site`` object representing the current site. This is useful for ``{{ site.domain }}`` or ``{{ site.name }}``. @@ -145,6 +145,16 @@ put into those elements. Both ``get_absolute_url()`` and ``item_link()`` should return the item's URL as a normal Python string. + * For the LatestEntries example above, we could have very simple feed templates: + + * latest_title.html:: + + {{ obj.title }} + + * latest_description.html:: + + {{ obj.description }} + .. _chicagocrime.org: http://www.chicagocrime.org/ .. _object-relational mapper: http://www.djangoproject.com/documentation/db_api/ .. _Django templates: http://www.djangoproject.com/documentation/templates/