diff options
author | Robin Munn <robin.munn@gmail.com> | 2006-11-08 04:50:01 +0000 |
---|---|---|
committer | Robin Munn <robin.munn@gmail.com> | 2006-11-08 04:50:01 +0000 |
commit | dadfca08c0db567ce33284aaa8eb388cf667a836 (patch) | |
tree | ab7255eeee1bbe03d95652cc74a3843fa052d8ac /docs/syndication_feeds.txt | |
parent | 0b059aa4eadc1d95ceca3a32821b65a9fb2a53e8 (diff) | |
download | django-dadfca08c0db567ce33284aaa8eb388cf667a836.tar.gz |
sqlalchemy: Merged revisions 3918 to 4053 from trunk.
git-svn-id: http://code.djangoproject.com/svn/django/branches/sqlalchemy@4054 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/syndication_feeds.txt')
-rw-r--r-- | docs/syndication_feeds.txt | 18 |
1 files 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 ``<item>`` has a ``<title>``, 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/ |