Django

Code

Changeset 1197

Show
Ignore:
Timestamp:
11/11/05 22:00:35 (3 years ago)
Author:
adrian
Message:

More small tweaks to docs/syndication_feeds.txt

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/docs/syndication_feeds.txt

    r1196 r1197  
    9090---------------- 
    9191 
    92 This simple example, taken from chicagocrime.org, describes a feed of the 
     92This simple example, taken from `chicagocrime.org`_, describes a feed of the 
    9393latest five news items:: 
    9494 
     
    133133 
    134134      If you don't create a template for either the title or description, the 
    135       framework will use the template ``{{ obj }}`` by default -- that is, the 
    136       normal string representation of the object. 
     135      framework will use the template ``"{{ obj }}"`` by default -- that is, 
     136      the normal string representation of the object. 
    137137    * To specify the contents of ``<link>``, you have two options. For each 
    138138      item in ``items()``, Django first tries executing a 
     
    143143      URL as a normal Python string. 
    144144 
     145.. _chicagocrime.org: http://www.chicagocrime.org/ 
    145146.. _object-relational mapper: http://www.djangoproject.com/documentation/db_api/ 
    146147.. _Django templates: http://www.djangoproject.com/documentation/templates/ 
     
    151152The framework also supports more complex feeds, via parameters. 
    152153 
    153 For example, chicagocrime.org offers an RSS feed of recent crimes for every 
     154For example, `chicagocrime.org`_ offers an RSS feed of recent crimes for every 
    154155police beat in Chicago. It'd be silly to create a separate ``Feed`` class for 
    155156each police beat; that would violate the `DRY principle`_ and would couple data 
    156 to programming logic. Instead, the RSS framework lets you make generic feeds 
    157 that output items based on information in the feed's URL. 
     157to programming logic. Instead, the syndication framework lets you make generic 
     158feeds that output items based on information in the feed's URL. 
    158159 
    159160On chicagocrime.org, the police-beat feeds are accessible via URLs like this: 
     
    162163    * ``/rss/beats/1424/`` -- Returns recent crimes for beat 1424. 
    163164 
    164 The slug here is ``beats``. The syndication framework sees the extra URL bits 
     165The slug here is ``"beats"``. The syndication framework sees the extra URL bits 
    165166after the slug -- ``0613`` and ``1424`` -- and gives you a hook to tell it what 
    166167those URL bits mean, and how they should influence which items get published in 
     
    208209      ``get_object()`` tells Django to produce a 404 error for that request. 
    209210    * To generate the feed's ``<title>``, ``<link>`` and ``<description>``, 
    210       Django uses the ``title``, ``link`` and ``description`` methods. In the 
    211       previous example, they were simple string class attributes, but this 
     211      Django uses the ``title()``, ``link()`` and ``description()`` methods. In 
     212      the previous example, they were simple string class attributes, but this 
    212213      example illustrates that they can be either strings *or* methods. For 
    213214      each of ``title``, ``link`` and ``description``, Django follows this 
     
    243244Note that you set ``feed_type`` to a class object, not an instance. 
    244245 
    245 Currently available feed types are:: 
     246Currently available feed types are: 
    246247 
    247248    * ``django.utils.feedgenerator.Rss201rev2Feed`` (RSS 2.01. Default.) 
     
    500501They share this interface: 
    501502 
    502 ``__init__(title, link, description, language=None, author_email=None, 
    503 author_name=None, author_link=None, subtitle=None, categories=None)`` 
     503``__init__(title, link, description, language=None, author_email=None,`` 
     504``author_name=None, author_link=None, subtitle=None, categories=None)`` 
    504505 
    505506Initializes the feed with the given metadata, which applies to the entire feed 
     
    509510which should be a sequence of Unicode objects. 
    510511 
    511 ``add_item(title, link, description, author_email=None, author_name=None, 
    512 pubdate=None, comments=None, unique_id=None, enclosure=None, categories=())`` 
     512``add_item(title, link, description, author_email=None, author_name=None,`` 
     513``pubdate=None, comments=None, unique_id=None, enclosure=None, categories=())`` 
    513514 
    514515Add an item to the feed with the given parameters. All parameters, if given, 
    515516should be Unicode objects, except: 
    516517 
    517     * ``pubdate`` should be a Python datetime object
     518    * ``pubdate`` should be a `Python datetime object`_
    518519    * ``enclosure`` should be an instance of ``feedgenerator.Enclosure``. 
    519520    * ``categories`` should be a sequence of Unicode objects. 
     
    551552 
    552553.. _django/utils/feedgenerator.py: http://code.djangoproject.com/browser/django/trunk/django/utils/feedgenerator.py 
     554.. _Python datetime object: http://www.python.org/doc/current/lib/module-datetime.html