Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #2987: cleaned up the syndication documentation a bit, thanks t…

…o dev@simon.net.nz.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@4031 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 09d40c508a54e79dc324f62410fac7f34526a1f7 1 parent 644af22
@jacobian jacobian authored
Showing with 14 additions and 4 deletions.
  1. +14 −4 docs/syndication_feeds.txt
View
18 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/
Please sign in to comment.
Something went wrong with that request. Please try again.