El 22/01/10 07:31, Kenny Meyer escribió:
> I'm trying to generate some feeds for my blog with Django's high-level
> Syndication Framework. 
> My problem is, when browsing to the URL defined in the ``link``
> attribute of the ``syndication.Feed`` model, there's no Feed
> generated/displayed.
>   
The link attribute is just what will show in the feed markup as.. well..
the feed's link, doesn't
necessarily have to be the subscription url. You usually want to set it
to the url for that content in your site. Look at Django's community
aggregator feed:

    <?xml version="1.0" encoding="utf-8"?>
    <rss version="2.0">
      <channel>
        <title>The Django community aggregator</title>
        <link>http://www.djangoproject.com/community/</link>
        ...

While the link attribute is http://www.djangoproject.com/community/ ,
the feed's url is actually http://www.djangoproject.com/rss/community/

> If not clear what I'm trying to say, please read details on the bottom
> of this message.
>
> Here's my code:
>
> apps/blog/feeds.py:
>
> from django.contrib.syndication.feeds import Feed
> from blog.models import Post
>
> class LatestPosts(Feed):
>     """Returns a Feed object with the 5 latest blog posts"""
>     link = "/blog/"
>     title = "Latest Blog Posts"
>     description = "Latest blog posts from the Paraguayan Geek."
>
>     def items(self):
>         return Post.objects.order_by('-date')[:5]
>
> apps/blog/urls.py: [shortened]
>
> feeds = {
>     'latest': LatestPosts,
> }
>
> urlpatterns = patterns(
>     '',
>     (r'^feeds/(?P<url>.*)/$', 'django.contrib.syndication.views.feed',
>                        {'feed_dict': feeds},)
> )
>
> -----------
> OBSERVATION
> -----------
>
> I access the feed with http://localhost:8000/blog/feeds/latest/ and it
> works just fine. Displays the latest articles with title and
> description.
>   

That's the subscription URL you have to use.

> -------
> PROBLEM
> -------
>
> Now as mention earlier, when browsing to http://localhost:8000/blog/
> there's no option for subscribing to the feed.
> I've compared a lot of configurations and I cannot see the problem.
>   

Well, isn't that something you'd define yourself? Or what do you mean by
"option for subscribing to the feed"?


-- 
Gonzalo Delgado <gonzalo...@gmail.com>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to