Fixed ReST bugs in docs/syndication_feeds.txt

git-svn-id: http://code.djangoproject.com/svn/django/trunk@1195 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2005-11-12 03:48:14 +00:00
parent 944de9e9e6
commit 10214bdac0
1 changed files with 16 additions and 12 deletions

View File

@ -124,11 +124,13 @@ put into those elements.
``feeds/sitenews_description``, where ``sitenews`` is the ``slug`` ``feeds/sitenews_description``, where ``sitenews`` is the ``slug``
specified in the URLconf for the given feed. The RSS system renders that specified in the URLconf for the given feed. The RSS system renders that
template for each item, passing it two template context variables: template for each item, passing it two template context variables:
* ``{{ obj }}`` -- The current object (one of whichever objects you
returned in ``items()``). * ``{{ obj }}`` -- The current object (one of whichever objects you
* ``{{ site }}`` -- A ``django.models.core.sites.Site`` object returned in ``items()``).
representing the current site. This is useful for * ``{{ site }}`` -- A ``django.models.core.sites.Site`` object
``{{ site.domain }}`` or ``{{ site.name }}``. representing the current site. This is useful for
``{{ site.domain }}`` or ``{{ site.name }}``.
If you don't create a template for either the title or description, the If you don't create a template for either the title or description, the
framework will use the template ``{{ obj }}`` by default -- that is, the framework will use the template ``{{ obj }}`` by default -- that is, the
normal string representation of the object. normal string representation of the object.
@ -210,10 +212,12 @@ request to the URL ``/rss/beats/0613/``:
example illustrates that they can be either strings *or* methods. For example illustrates that they can be either strings *or* methods. For
each of ``title``, ``link`` and ``description``, Django follows this each of ``title``, ``link`` and ``description``, Django follows this
algorithm: algorithm:
* First, it tries to call a method, passing the ``obj`` argument, where
``obj`` is the object returned by ``get_object()``. * First, it tries to call a method, passing the ``obj`` argument, where
* Failing that, it tries to call a method with no arguments. ``obj`` is the object returned by ``get_object()``.
* Failing that, it uses the class attribute. * Failing that, it tries to call a method with no arguments.
* Failing that, it uses the class attribute.
* Finally, note that ``items()`` in this example also takes the ``obj`` * Finally, note that ``items()`` in this example also takes the ``obj``
argument. The algorithm for ``items`` is the same as described in the argument. The algorithm for ``items`` is the same as described in the
previous step -- first, it tries ``items(obj)``, then ``items()``, then previous step -- first, it tries ``items(obj)``, then ``items()``, then
@ -304,7 +308,7 @@ And the accompanying URLconf::
) )
Feed class reference Feed class reference
------------------- --------------------
This example illustrates all possible attributes and methods for a ``Feed`` class:: This example illustrates all possible attributes and methods for a ``Feed`` class::
@ -496,7 +500,7 @@ Each of these three classes knows how to render a certain type of feed as XML.
They share this interface:: They share this interface::
``__init__(title, link, description, language=None, author_email=None, ``__init__(title, link, description, language=None, author_email=None,
author_name=None, author_link=None, subtitle=None, categories=None)`` author_name=None, author_link=None, subtitle=None, categories=None)``
Initializes the feed with the given metadata, which applies to the entire feed Initializes the feed with the given metadata, which applies to the entire feed
(i.e., not just to a specific item in the feed). (i.e., not just to a specific item in the feed).
@ -505,7 +509,7 @@ All parameters, if given, should be Unicode objects, except ``categories``,
which should be a sequence of Unicode objects. which should be a sequence of Unicode objects.
``add_item(title, link, description, author_email=None, author_name=None, ``add_item(title, link, description, author_email=None, author_name=None,
pubdate=None, comments=None, unique_id=None, enclosure=None, categories=())`` pubdate=None, comments=None, unique_id=None, enclosure=None, categories=())``
Add an item to the feed with the given parameters. All parameters, if given, Add an item to the feed with the given parameters. All parameters, if given,
should be Unicode objects, except: should be Unicode objects, except: