Skip to content

Commit

Permalink
Fixed #19306 - Improved syndication example.
Browse files Browse the repository at this point in the history
Thanks brycenesbitt for the report.
  • Loading branch information
timgraham committed Nov 18, 2012
1 parent 2564e31 commit 1f1f60d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docs/ref/contrib/syndication.txt
Expand Up @@ -53,6 +53,7 @@ This simple example, taken from `chicagocrime.org`_, describes a feed of the
latest five news items::

from django.contrib.syndication.views import Feed
from django.core.urlresolvers import reverse
from chicagocrime.models import NewsItem

class LatestEntriesFeed(Feed):
Expand All @@ -69,6 +70,10 @@ latest five news items::
def item_description(self, item):
return item.description

# item_link is only needed if NewsItem has no get_absolute_url method.
def item_link(self, item):
return reverse('news-item', args=[item.pk])

To connect a URL to this feed, put an instance of the Feed object in
your :doc:`URLconf </topics/http/urls>`. For example::

Expand Down

0 comments on commit 1f1f60d

Please sign in to comment.