开发者

problem reversing feed url

I am using the development version. I get the error below when I try to reverse lookup my feed's URL.

Can anyone help please?

thanks konstantin

in my urls.py:


...
url(r'^f/blog/$', 'django.contrib.syndication.views.Feed', BlogFeed(), name='blog-feed'),
...

in my template:


...
{% url blog-feed %}
...

开发者_JAVA百科the error:


...
Caught AttributeError while rendering: 'BlogFeed' object has no attribute 'keys'
...


If your BlogFeed class is the class based view, I don't think you need the 'django.contrib.syndication.views.Feed' part... your BlogFeed should be a subclass of that. (django docs)

url(r'^f/blog/$', BlogFeed(), name="blog-feed"),


The third argument to url should be a dictionary. I'm not sure why you've got a class.

Maybe what you are trying to do is,

url(r'^f/blog/$', 'django.contrib.syndication.views.Feed', {'name_of_view_arg':BlogFeed()}, name="blog-feed"),
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜