diff options
| author | Tim Graham <timograham@gmail.com> | 2012-11-18 18:07:38 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2012-11-18 18:09:00 -0500 |
| commit | 17c61aaea303a5f21537d9978c28135f6f17b489 (patch) | |
| tree | be76a6602974bb8bbea25eb33fbf9cb6c9794e94 | |
| parent | eb67a45a39a39d86faeefa1dc466fe2a6065655a (diff) | |
[1.5.X] Fixed #19306 - Improved syndication example.
Thanks brycenesbitt for the report.
Backport of 1f1f60d12f from master
| -rw-r--r-- | docs/ref/contrib/syndication.txt | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/docs/ref/contrib/syndication.txt b/docs/ref/contrib/syndication.txt index 27b8fc0875..2418dba8ef 100644 --- a/docs/ref/contrib/syndication.txt +++ b/docs/ref/contrib/syndication.txt @@ -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): @@ -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:: |
