Django

Code

Changeset 4988

Show
Ignore:
Timestamp:
04/09/07 10:48:08 (2 years ago)
Author:
adrian
Message:

Edited docs/syndication_feeds.txt changes from [4982]

Files:

Legend:

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

    r4982 r4988  
    115115      instances. Although you get a few bits of functionality "for free" by 
    116116      using Django models, ``items()`` can return any type of object you want. 
    117     * If you are creating an Atom feed, rather than the default RSS feed, you 
    118       will want to set the ``subtitle`` attribute instead of the 
    119       ``description`` attribute. See `Publishing Atom and RSS feeds in 
    120       tandem`_, later, for an example. 
     117    * If you're creating an Atom feed, rather than an RSS feed, set the 
     118      ``subtitle`` attribute instead of the ``description`` attribute. See 
     119      `Publishing Atom and RSS feeds in tandem`_, later, for an example. 
    121120 
    122121One thing's left to do. In an RSS feed, each ``<item>`` has a ``<title>``, 
     
    303302 
    304303Some developers like to make available both Atom *and* RSS versions of their 
    305 feeds. That's easy to do with Django: Just create a subclass of your ``feed`` 
     304feeds. That's easy to do with Django: Just create a subclass of your ``Feed`` 
    306305class and set the ``feed_type`` to something different. Then update your 
    307306URLconf to add the extra versions. 
     
    323322    class AtomSiteNewsFeed(RssSiteNewsFeed): 
    324323        feed_type = Atom1Feed 
    325         subtitle = description 
     324        subtitle = RssSiteNewsFeed.description 
    326325 
    327326.. Note:: 
    328     In Atom feeds, there is no feed-level description element. There *is* a 
    329     subtitle element, however. Your RSS feed description may be too verbose 
    330     for a subtitle, so Django does not automatically put the feed description 
    331     into the subtitle element. Instead, you should create a ``subtitle`` 
    332     attribute in your model, containing an appropriate string. In the above 
    333     example, we have used the RSS feed's description, since it is quite short 
    334     already. 
     327    In this example, the RSS feed uses a ``description`` while the Atom feed 
     328    uses a ``subtitle``. That's because Atom feeds don't provide for a 
     329    feed-level "description," but they *do* provide for a "subtitle." 
     330 
     331    If you provide a ``description`` in your ``Feed`` class, Django will *not* 
     332    automatically put that into the ``subtitle`` element, because a subtitle 
     333    and description are not necessarily the same thing. Instead, you should 
     334    define a ``subtitle`` attribute. 
     335 
     336    In the above example, we simply set the Atom feed's ``subtitle`` to the 
     337    RSS feed's ``description``, because it's quite short already. 
    335338 
    336339And the accompanying URLconf::